CWIS Developer Documentation

- Home
- Main Page
- Classes
- Files

- File List
- File Members

OptionFormField.php
Go to the documentation of this file.
1 <?PHP
2
3 #
4 # FILE: OptionFormField.php
5 #
6 # Part of the Collection Workflow Integration System (CWIS)
7 # Copyright 2013 Edward Almasy and Internet Scout Research Group
8 # http://scout.wisc.edu/cwis/
9 #
10
16 class OptionFormField extends FormField {
17
18 # ---- PUBLIC INTERFACE --------------------------------------------------
19
22
33 function OptionFormField(
34 $Name, $IsRequired, $Label, $Length, $Options,
35 $ValidFunc = NULL, $ValidMsgs = NULL)
36 {
37 $this->MyLength = $Length;
38 $this->MyOptions = $Options;
39
40 $this->FormField($Name, $IsRequired, $Label, $ValidFunc, $ValidMsgs);
41 }
46
52 function Length($NewVal = NULL) { return $this->GetOrSet("MyLength", $NewVal); }
53
59 function Options($NewVal = NULL) { return $this->GetOrSet("MyOptions", $NewVal); }
60
65
70 function PrintInput($DisplayErrorIndicator = FALSE)
71 {
72 print("<select name=\"".$this->MyName."\" size=\"".$this->MyLength."\">\n");
73 foreach ($this->MyOptions as $OptionValue => $OptionLabel)
74 {
75 print(" <option value=\"".htmlspecialchars($OptionValue)."\""
76 .(($OptionValue == $this->Value()) ? " selected" : "")
77 .">".htmlspecialchars($OptionLabel)."\n");
78 }
79 print("</select>\n");
80 }
84 # ---- PRIVATE INTERFACE -------------------------------------------------
85
86 private $MyLength;
87 private $MyOptions;
88 }
89
90 ?>
FormField
Generator for HTML form fields.
Definition: FormField.php:14
FormField\FormField
FormField($Name, $IsRequired, $Label, $ValidFunc, $ValidMsgs)
Object Constructor.
Definition: FormField.php:32
OptionFormField\Length
Length($NewVal=NULL)
Get or set the length of the display field.
Definition: OptionFormField.php:52
OptionFormField\Options
Options($NewVal=NULL)
Get or set the list of options displayed by this field.
Definition: OptionFormField.php:59
OptionFormField\PrintInput
PrintInput($DisplayErrorIndicator=FALSE)
Generate HTML representing this object.
Definition: OptionFormField.php:70
PHP
PHP
Definition: OAIClient.php:39
OptionFormField
Generator for option form fields.
Definition: OptionFormField.php:16
OptionFormField\OptionFormField
OptionFormField($Name, $IsRequired, $Label, $Length, $Options, $ValidFunc=NULL, $ValidMsgs=NULL)
Object constructor.
Definition: OptionFormField.php:33
FormField\Value
Value($NewVal=NULL)
Get or set the form field value.
Definition: FormField.php:88