sunlabs.brazil.sunlabs
Class FormHelpTemplate

java.lang.Object
  extended by sunlabs.brazil.template.Template
      extended by sunlabs.brazil.template.FormTemplate
          extended by sunlabs.brazil.sunlabs.FormHelpTemplate (view source)
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". If foo.help is a defined property then it is used as the help text.


Field Summary
 
Fields inherited from class sunlabs.brazil.template.Template
debug
 
Constructor Summary
FormHelpTemplate()
           
 
Method Summary
 boolean done(RewriteContext hr)
          This is for debugging only !!
 boolean init(RewriteContext hr)
          Save a reference to our request properties.
 void tag_form(RewriteContext hr)
          Look for a "help" attribute, remember its value, then remove it .
 void tag_input(RewriteContext hr)
          Look for a "help" attribute, remember its value, then remove it .
 void tag_option(RewriteContext hr)
          Needed to retain parent functionality.
 void tag_select(RewriteContext hr)
          Look for a "help" attribute, remember its value, then remove it .
 void tag_slash_form(RewriteContext hr)
          Forget about the "help" action.
 void tag_slash_select(RewriteContext hr)
          Needed to retain parent functionality.
 void tag_textarea(RewriteContext hr)
          Look for a "help" attribute, remember its value, then remove it .
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormHelpTemplate

public FormHelpTemplate()
Method Detail

init

public boolean init(RewriteContext hr)
Description copied from class: FormTemplate
Save a reference to our request properties.

Specified by:
init in interface TemplateInterface
Overrides:
init in class FormTemplate

tag_form

public void tag_form(RewriteContext hr)
Look for a "help" attribute, remember its value, then remove it .

Overrides:
tag_form in class FormTemplate

tag_slash_form

public void tag_slash_form(RewriteContext hr)
Forget about the "help" action.

Overrides:
tag_slash_form in class FormTemplate

tag_input

public void tag_input(RewriteContext hr)
Look for a "help" attribute, remember its value, then remove it .

Overrides:
tag_input in class FormTemplate

tag_select

public void tag_select(RewriteContext hr)
Look for a "help" attribute, remember its value, then remove it .

Overrides:
tag_select in class FormTemplate

tag_slash_select

public void tag_slash_select(RewriteContext hr)
Needed to retain parent functionality.

Overrides:
tag_slash_select in class FormTemplate

tag_option

public void tag_option(RewriteContext hr)
Needed to retain parent functionality.

Overrides:
tag_option in class FormTemplate

tag_textarea

public void tag_textarea(RewriteContext hr)
Look for a "help" attribute, remember its value, then remove it .


done

public boolean done(RewriteContext hr)
Description copied from class: FormTemplate
This is for debugging only !!

Specified by:
done in interface TemplateInterface
Overrides:
done in class FormTemplate

Version Kenai-svn-r24, Generated 08/18/09
Copyright (c) 2001-2009, Sun Microsystems.