Class SelectOption

java.lang.Object
fc.web.simpleforms.SelectOption

public final class SelectOption extends Object
Represents an option for a select input type. This class is the fc.web.simpleforms equivalent to the similar class Select.Option found in package fc.web.forms
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new unselected option with the specified html text and no separate value.
    SelectOption(String text, boolean selected)
    Constructs a new option with the specified text (and no separate value tag).
    SelectOption(String text, String value)
    Constructs a new unselected option with the specified text and value of the option tag.
    SelectOption(String text, String value, boolean selected)
    Constructs a new option with the specified text and value of the option tag.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the html text for this option.
    Returns the value of this option tag.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SelectOption

      public SelectOption(String text, String value, boolean selected)
      Constructs a new option with the specified text and value of the option tag.
      Parameters:
      text - the html text of the option tag
      value - the value of the option tag
      selected - true if this option is selected by default. If more than one selected option is added to a select field and that select field does not have it's multiple attribute set, then the option displayed as selected is browser dependent (Moz1, IE6 show the last selected, N4 the first). More than one selected option should not be shown for non multiple select fields anyway.
    • SelectOption

      public SelectOption(String text, String value)
      Constructs a new unselected option with the specified text and value of the option tag.
      Parameters:
      text - the html text of the option tag
      value - the value of the option tag
    • SelectOption

      public SelectOption(String text, boolean selected)
      Constructs a new option with the specified text (and no separate value tag).
      Parameters:
      text - the html text of the option tag
      selected - true to select this option false otherwise
    • SelectOption

      public SelectOption(String text)
      Constructs a new unselected option with the specified html text and no separate value.
      Parameters:
      text - the html text of the option tag
  • Method Details

    • getValue

      public String getValue()
      Returns the value of this option tag. If no value is set, returns the html text value for this option tag
    • getHTML

      public String getHTML()
      Returns the html text for this option.