Search:

CWIS Developers Documentation

  • Main Page
  • Classes
  • Files
  • File List
  • File Members

OptionFormField.php

Go to the documentation of this file.
00001 <?PHP
00002 
00008 class OptionFormField extends FormField {
00009 
00010     # ---- PUBLIC INTERFACE --------------------------------------------------
00011     
00014 
00025     function OptionFormField(
00026             $Name, $IsRequired, $Label, $Length, $Options, 
00027             $ValidFunc = NULL, $ValidMsgs = NULL)
00028     {
00029         $this->MyLength = $Length;
00030         $this->MyOptions = $Options;
00031 
00032         $this->FormField($Name, $IsRequired, $Label, $ValidFunc, $ValidMsgs);
00033     }
00038 
00044     function Length($NewVal = NULL) {  return $this->GetOrSet("MyLength", $NewVal);  }
00045    
00051     function Options($NewVal = NULL) {  return $this->GetOrSet("MyOptions", $NewVal);  }
00052 
00057     
00062     function PrintInput($DisplayErrorIndicator = FALSE)
00063     {
00064         print("<select name=\"".$this->MyName."\" size=\"".$this->MyLength."\">\n");
00065         foreach ($this->MyOptions as $OptionValue => $OptionLabel)
00066         {
00067             print("    <option value=\"".htmlspecialchars($OptionValue)."\""
00068                     .(($OptionValue == $this->Value()) ? " selected" : "")
00069                     .">".htmlspecialchars($OptionLabel)."\n");
00070         }
00071         print("</select>\n");
00072     }
00076     # ---- PRIVATE INTERFACE -------------------------------------------------
00077     
00078     private $MyLength;
00079     private $MyOptions;
00080 }
00081 
00082 ?>
CWIS logo doxygen
Copyright 2009 Internet Scout