Implemented: Render form field for edit Plugin handler
New Plugin callback:
renderFormFieldForEditHandler ( $name, $type, $size, $value, $attributes, $possibleValues )
This handler is called by Form.renderForEdit, before built-in types are considered. It generates the
HTML text rendering this form field, or false, if the rendering should be done by the built-in type handlers
Parameters:
-
$name name of form field
-
$type type of form field
-
$size size of form field
-
$value value held in the form field
-
$attributes attributes of form field
-
$possibleValues the values defined as options for form field, if any
Return:
$text HTML text that renders this field. If false, form rendering continues by considering the built-in types.
Typical usage is in the style of Form.renderForEdit:
if ( is_type1($type) ) {
$ret = compute_formating_for_type1();
} elsif ( is_type2($type) ) {
$ret = compute_formating_for_type2();
} ...
clean_up_if_necessary($ret);
return $ret;
Note that a common application would be to generate formatting of the
field involving generation of javascript. Such usually also requires
the insertion of some common javascript into the page header. Unfortunately,
there is currently no mechanism to pass that script to where the header of
the page is visible. Consequentially, the common javascript will have to
be emitted as part of the field formatting and might be duplicated many
times throughout the page.
Contributors:
--
JohnTalintyre - 04 Jun 2003
--
SvenDowideit - 27 Jun 2004
--
ThomasWeigert - 06 Jul 2004
--
PeterThoeny - 20 Jul 2004
Discussions
This is in the code for a while but not yet documented. At what TWiki::Plugins::VERSION? This needs to be done for
CairoRelease.
Also, the function name is kind of long. Is it too late to change? Is anyone already using this callback?
--
PeterThoeny - 20 Jul 2004
This function has been documented as described in
ExtendingFormControls and the documentation has been committed to
SVN by
Sven.
Regarding the question on use, this function is used in
FormFieldsPlugin, but truth-be-tols, that plugin is not really done, I believe, as it really needs an additional callback that allows adding of Javascript to the top of the page. That functionality in TWiki.pm was removed by
Walter. So I think you can change the name of this callback, albeit it seems like a good name.
--
ThomasWeigert - 20 Jul 2004
I like the name. It tells me exactly what the handler is for. And its not like there are very many of us using old vt100's and line printers anymore, nor do we need to save core memory space
--
SvenDowideit - 20 Jul 2004
Carried over documentation from
ExtendingFormControls.
Documenting the version in
PluginsDotPm,
EmptyPluginDotPm and
DefaultPluginDotPm is still pending.
Callback is not yet added as a DISABLEd function in
EmptyPluginDotPm and
DefaultPluginDotPm.
--
PeterThoeny - 08 Aug 2004