Class InputTag

All Implemented Interfaces:
Serializable, IterationTag, JspTag, Tag
Direct Known Subclasses:
AirportCodeTag, EMailInputTag, HTML5InputTag

public class InputTag extends FormElementTag
A JSP tag to generate HTML text field elements.
Since:
1.0
Version:
10.3
Author:
Luke
See Also:
  • Constructor Details

    • InputTag

      public InputTag()
      Create a new Input element tag of type TEXT.
      See Also:
  • Method Details

    • doEndTag

      public int doEndTag() throws JspException
      Generates the HTML for this Input element. If a non-String value is set, this method calls the value's toString() method to render it.
      Specified by:
      doEndTag in interface Tag
      Overrides:
      doEndTag in class TagSupport
      Throws:
      JspException - if an error occurs
      See Also:
    • release

      public void release()
      Specified by:
      release in interface Tag
      Overrides:
      release in class ElementTag
    • setType

      public void setType(String type)
      Sets the HTML field type. This is typically either TEXT or HIDDEN. If no type is explictly set, then the TYPE will be rendered as TEXT.
      Parameters:
      type - the field type
    • setSize

      public void setSize(int len)
      Sets the size of this field. This does nothing if a negative, zero or non-numeric value is passed.
      Parameters:
      len - the size of the field
      See Also:
    • setMax

      public void setMax(int maxLen)
      Sets the maximum length of this field. This does nothing if a negative, zero or non-numeric value is passed.
      Parameters:
      maxLen - the maximum length of the field
      See Also:
    • setAutoComplete

      public void setAutoComplete(boolean isAutoComplete)
      Disables or enables autocomplete support for this field.
      Parameters:
      isAutoComplete - TRUE if AutoComplete enabled, otherwise FASE
    • setAutofill

      public void setAutofill(String token)
      Sets the autofill token for this field. This will automatically enable autocomplete.
      Parameters:
      token - the autofill token
    • setReadOnly

      public void setReadOnly(boolean readOnly)
      Marks this field as read-only.
      Parameters:
      readOnly - TRUE if read-only, otherwise FALSE
    • setDisabled

      public void setDisabled(boolean disabled)
      Marks this field as disabled.
      Parameters:
      disabled - TRUE if disabled, otherwise FALSE
    • setSpellcheck

      public void setSpellcheck(boolean sc)
      Marks this field as spellcheckable.
      Parameters:
      sc - TRUE if spellcheck enabled, otherwise FALSE
    • setPlaceholder

      public void setPlaceholder(String ph)
      Sets the placeholder for this field.
      Parameters:
      ph - the placeholder string
    • setOnBlur

      public void setOnBlur(String jsCode)
      Sets the JavaScript event for this element's onBlur() event.
      Parameters:
      jsCode - the JavaScript code
    • setOnChange

      public void setOnChange(String jsCode)
      Sets the JavaScript event for this element's onChange() event.
      Parameters:
      jsCode - the JavaScript code
    • setOnKeyup

      public void setOnKeyup(String jsCode)
      Sets the JavaScript event for this element's onKeyUp() event.
      Parameters:
      jsCode - the JavaScript code
    • setOnKeypress

      public void setOnKeypress(String jsCode)
      Sets the JavaScript event for this element's onKeyPress() event.
      Parameters:
      jsCode - the JavaScript code
    • setOnRightClick

      public void setOnRightClick(String js)
      Sets the Javascript to execute when the element is right-clicked.
      Parameters:
      js - the JavaScript code to execute