Package sunlabs.brazil.sunlabs
Class FormHelpTemplate
java.lang.Object
sunlabs.brazil.template.Template
sunlabs.brazil.template.FormTemplate
sunlabs.brazil.sunlabs.FormHelpTemplate
- All Implemented Interfaces:
TemplateInterface
Template class for adding field help to the FormTemplate.
The "help" attribute of the <form> element specifies a javascript
template used to generate an event handler for each form element.
The "help" attribute on each form element is passed to the javascript
template, allowing a (user supplied) javascript function to present
field specific help. The help text for each feld may be supplied
as a server config file.
"help" feature:
This template may be used to provide field specific help with a little
external javascript "glue". For example, the markup:
<form event=onfocus help="do_help(%)"> ... <input name=foo ... help="help for this input field"> ... </form>will generate:
<form> ... <input ... onfocus='do_help("help for this input field")'> ... </form>This works with the form elements <input> <select>, and <textarea>. The "event" defaults to "onfocus". If
foo.help
is a defined property then it is used as
the help text.- Version:
- @(#)FormHelpTemplate.java 1.1
- Author:
- Stephen Uhler
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Look for help text, and put it into an event call.boolean
done
(RewriteContext hr) This is for debugging only !!protected String
Substitute "arg" into "base" at "%"boolean
init
(RewriteContext hr) Save a reference to our request properties.void
Look for a "help" attribute, remember its value, then remove it .void
Look for a "help" attribute, remember its value, then remove it .void
Needed to retain parent functionality.void
Look for a "help" attribute, remember its value, then remove it .void
Forget about the "help" action.void
Needed to retain parent functionality.void
Look for a "help" attribute, remember its value, then remove it .
-
Constructor Details
-
FormHelpTemplate
public FormHelpTemplate()
-
-
Method Details
-
init
Description copied from class:FormTemplate
Save a reference to our request properties.- Specified by:
init
in interfaceTemplateInterface
- Overrides:
init
in classFormTemplate
-
tag_form
Look for a "help" attribute, remember its value, then remove it .- Overrides:
tag_form
in classFormTemplate
-
tag_slash_form
Forget about the "help" action.- Overrides:
tag_slash_form
in classFormTemplate
-
tag_input
Look for a "help" attribute, remember its value, then remove it .- Overrides:
tag_input
in classFormTemplate
-
tag_select
Look for a "help" attribute, remember its value, then remove it .- Overrides:
tag_select
in classFormTemplate
-
tag_slash_select
Needed to retain parent functionality.- Overrides:
tag_slash_select
in classFormTemplate
-
tag_option
Needed to retain parent functionality.- Overrides:
tag_option
in classFormTemplate
-
tag_textarea
Look for a "help" attribute, remember its value, then remove it . -
do_help
Look for help text, and put it into an event call. First, see if the attribute "helpname" is specified, and use it to name the property containing the help text. Otherwise look in the "name".help property, and lastly the "help" attribute. -
format
Substitute "arg" into "base" at "%" -
done
Description copied from class:FormTemplate
This is for debugging only !!- Specified by:
done
in interfaceTemplateInterface
- Overrides:
done
in classFormTemplate
-