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
public class FormHelpTemplate extends FormTemplate
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". Iffoo.helpis a defined property then it is used as the help text.- Version:
- Author:
- Stephen Uhler
-
-
Constructor Summary
Constructors Constructor Description FormHelpTemplate()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddo_help(RewriteContext hr)Look for help text, and put it into an event call.booleandone(RewriteContext hr)This is for debugging only !!protected java.lang.Stringformat(java.lang.String base, java.lang.String arg)Substitute "arg" into "base" at "%"booleaninit(RewriteContext hr)Save a reference to our request properties.voidtag_form(RewriteContext hr)Look for a "help" attribute, remember its value, then remove it .voidtag_input(RewriteContext hr)Look for a "help" attribute, remember its value, then remove it .voidtag_option(RewriteContext hr)Needed to retain parent functionality.voidtag_select(RewriteContext hr)Look for a "help" attribute, remember its value, then remove it .voidtag_slash_form(RewriteContext hr)Forget about the "help" action.voidtag_slash_select(RewriteContext hr)Needed to retain parent functionality.voidtag_textarea(RewriteContext hr)Look for a "help" attribute, remember its value, then remove it .
-
-
-
Method Detail
-
init
public boolean init(RewriteContext hr)
Description copied from class:FormTemplateSave a reference to our request properties.- Specified by:
initin interfaceTemplateInterface- Overrides:
initin classFormTemplate
-
tag_form
public void tag_form(RewriteContext hr)
Look for a "help" attribute, remember its value, then remove it .- Overrides:
tag_formin classFormTemplate
-
tag_slash_form
public void tag_slash_form(RewriteContext hr)
Forget about the "help" action.- Overrides:
tag_slash_formin classFormTemplate
-
tag_input
public void tag_input(RewriteContext hr)
Look for a "help" attribute, remember its value, then remove it .- Overrides:
tag_inputin classFormTemplate
-
tag_select
public void tag_select(RewriteContext hr)
Look for a "help" attribute, remember its value, then remove it .- Overrides:
tag_selectin classFormTemplate
-
tag_slash_select
public void tag_slash_select(RewriteContext hr)
Needed to retain parent functionality.- Overrides:
tag_slash_selectin classFormTemplate
-
tag_option
public void tag_option(RewriteContext hr)
Needed to retain parent functionality.- Overrides:
tag_optionin classFormTemplate
-
tag_textarea
public void tag_textarea(RewriteContext hr)
Look for a "help" attribute, remember its value, then remove it .
-
do_help
protected void do_help(RewriteContext hr)
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
protected java.lang.String format(java.lang.String base, java.lang.String arg)Substitute "arg" into "base" at "%"
-
done
public boolean done(RewriteContext hr)
Description copied from class:FormTemplateThis is for debugging only !!- Specified by:
donein interfaceTemplateInterface- Overrides:
donein classFormTemplate
-
-