<?PHP

  /**
   * Generator for checkbox input fields
   * \nosubgrouping
   */

class CheckboxFormField extends FormField {

    # ---- PUBLIC INTERFACE --------------------------------------------------

    /**
     * Object constructor.
     * @param Name internal name of the checkbox field, used as the id= in HTML
     * @param Label Display name of the checkbox field, showed to the user
     */
    function CheckboxFormField($Name, $Label)
    {
        $this->FormField($Name, FALSE, $Label, NULL, NULL);
    }

    /**
     * Generate HTML for the int field and label.
     * @param DisplayErrorIndicator
     *   Setting TRUE will generate html error indicators (OPTIONAL)
     */
    function PrintField($DisplayErrorIndicator = FALSE)
    {
        $this->PrintInput($DisplayErrorIndicator);
        $this->PrintLabel($DisplayErrorIndicator);
    }

    /**
     * Generate HTML just for the input field.
     * @param DisplayErrorIndicator
     *   Setting TRUE will generate html error indicators (OPTIONAL)
     */
    function PrintInput($DisplayErrorIndicator = FALSE)
    {
        print("<input type=\"checkbox\""
                ." name=\"".$this->MyName."\""
                ." id=\"".$this->MyName."\""
                .($this->MyValue ? " checked" : "")
                .">\n");
    }


    # ---- PRIVATE INTERFACE -------------------------------------------------

}

?>
