|
The Metadata Plugin Metadata Management for Manila |
Site last updated 2/24/2006; 12:33:21 PM |
|
Custom Field Formats
A custom field format uses a callback to generate HTML for the input field. Here's how it works. When you pick a field format for one of your meta types, the Metadata Plugin builds a form for that field when you edit a page in your browser. You can pick among a variety of field formats, like dropbox or checkbox. But sometimes you want to customize the input form beyond what the plugin gives you. Maybe you want to use JavaScript field validation or play an annoying sound when the cursor enters the field. The custom field format allows you to do this. When you pick custom for the field format of your meta type, the Plugin will look for a script to generate the HTML for the input field. Where will it look? Suppose you have a meta type named 'keywords'. The plugin would look in @myManilaWebsite.["plugins"].data.metaData.keywords. When you choose custom as the field format, the plugin copies an example script to that location. Simply modify the example script or delete it entirely and replace it with your own. Here are the comments and contents of the example script:
This script is copied from metaDataData.callbacks.defaultCustomFormat.
There is a copy of this script for each custom meta type. Eg., if the keywords meta type has it's format set to custom, this script would be found at @myManilaWebsite.["#plugins"].data.metaData.customFormats.keywords.
This script needs to return a table row (two columns) with a valid input field.
If you need msgNum or other info, check the gridtable (eg. pta^.gridtable.msgNum)
The following variables are in scope:
A simple script is given for you below. You should comment it out and replace it with your own.
return("<tr><td align='right'><b>" + metaname + "</b></td><td><input type='text' name='" + metaDataSuite.metaEdit.dsp_prefix + metaname + "' value='" + s + "' size='" + len + "'></td></tr>")
|
|||||||||||||||||||
| This page last updated Sunday, June 30, 2002 at 2:27:42 PM. | (7359) |