CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

OptionFormField.php
Go to the documentation of this file.
1 <?PHP
2 #
3 # FILE: OptionFormField.php
4 #
5 # Part of the Collection Workflow Integration System (CWIS)
6 # Copyright 2013-2015 Edward Almasy and Internet Scout Research Group
7 # http://scout.wisc.edu/cwis/
8 #
9
14 class OptionFormField extends FormField
15 {
16
17 # ---- PUBLIC INTERFACE --------------------------------------------------
18
21
32 public function __construct(
33 $Name, $IsRequired, $Label, $Length, $Options,
34 $ValidFunc = NULL, $ValidMsgs = NULL)
35 {
36 $this->MyLength = $Length;
37 $this->MyOptions = $Options;
38
39 parent::__construct($Name, $IsRequired, $Label, $ValidFunc, $ValidMsgs);
40 }
45
51 public function Length($NewVal = NULL)
52 {
53 return $this->GetOrSet("MyLength", $NewVal);
54 }
55
61 public function Options($NewVal = NULL)
62 {
63 return $this->GetOrSet("MyOptions", $NewVal);
64 }
65
70
75 public function PrintInput($DisplayErrorIndicator = FALSE)
76 {
77 print("<select name=\"".$this->MyName."\" size=\"".$this->MyLength."\">\n");
78 foreach ($this->MyOptions as $OptionValue => $OptionLabel)
79 {
80 print(" <option value=\"".htmlspecialchars($OptionValue)."\""
81 .(($OptionValue == $this->Value()) ? " selected" : "")
82 .">".htmlspecialchars($OptionLabel)."\n");
83 }
84 print("</select>\n");
85 }
89 # ---- PRIVATE INTERFACE -------------------------------------------------
90
91 private $MyLength;
92 private $MyOptions;
93 }
94
OptionFormField\__construct
__construct($Name, $IsRequired, $Label, $Length, $Options, $ValidFunc=NULL, $ValidMsgs=NULL)
Object constructor.
Definition: OptionFormField.php:32
FormField
Generator for HTML form fields.
Definition: FormField.php:14
OptionFormField\Length
Length($NewVal=NULL)
Get or set the length of the display field.
Definition: OptionFormField.php:51
OptionFormField\Options
Options($NewVal=NULL)
Get or set the list of options displayed by this field.
Definition: OptionFormField.php:61
OptionFormField\PrintInput
PrintInput($DisplayErrorIndicator=FALSE)
Generate HTML representing this object.
Definition: OptionFormField.php:75
PHP
PHP
Definition: RSSClient--Test.php:12
OptionFormField
Generator for option form fields.
Definition: OptionFormField.php:14
FormField\Value
Value($NewVal=NULL)
Get or set the form field value.
Definition: FormField.php:97