Forums/New Features

Admin forms can now be customized

Michael Slater
posted this on June 29, 2011, 10:46

One of the great time-savers of using Webvanta is that the admin forms for your database items are all automatically generated; all you need to do is specify the fields and their types.

A limitation of this approach, however, is that you have not, until now, been able to customize these forms.

We now have added a way to do so. If you create a Global Setting with the name admin.custom.control_panel.head_markup, you can then put in this setting any code you want (that can be injected between <head> tags in HTML), and it will run on every admin page after the rest of the page is loaded.

You could use this to load a stylesheet, if you wanted to override the styling (perhaps to be more consistent with your own brand colors).

The most powerful use of this feature is to use it to load a JavaScript file, which lets you manipulate the admin forms arbitrarily. For example, you might use something like this:

<script src="/admin-customize.js" type="text/javascript"></script>

And then put some jQuery code in admin-customize.js that would manipulate the form.

Note that the same code is loaded on every admin page, so you must use the IDs and classes that are unique to each page to target specific items. This can be a little tricky, so if you want to do this, we recommend that you submit a helpdesk ticket with a description of what you want to accomplish, and we will point you in the right direction.