CWIS Developer Documentation
TextFormField.php
Go to the documentation of this file.
1 <?PHP
2 #
3 # FILE: TextFormField.php
4 #
5 # Part of the Collection Workflow Integration System (CWIS)
6 # Copyright 2013 Edward Almasy and Internet Scout Research Group
7 # http://scout.wisc.edu/cwis/
8 #
9 
14 class TextFormField extends FormField
15 {
16 
17  # ---- PUBLIC INTERFACE --------------------------------------------------
18 
21 
34  public function __construct(
35  $Name, $IsRequired, $Label, $Length, $MaxLength,
36  $ValidFunc = NULL, $ValidMsgs = NULL)
37  {
38  $this->MyLength = $Length;
39  $this->MyMaxLength = $MaxLength;
40 
41  parent::__construct($Name, $IsRequired, $Label, $ValidFunc, $ValidMsgs);
42  }
43 
48 
54  public function Length($NewVal = NULL)
55  {
56  return $this->GetOrSet("MyLength", $NewVal);
57  }
58 
64  public function MaxLength($NewVal = NULL)
65  {
66  return $this->GetOrSet("MyMaxLength", $NewVal);
67  }
68 
73 
78  public function PrintInput($DisplayErrorIndicator = FALSE)
79  {
80  print("<input type=\"".
81  # (hack to support PasswordFormField object as well)
82  (method_exists($this, "PasswordFormField") ? "password" : "text")
83  ."\""
84  ." name=\"".$this->MyName."\""
85  ." value=\"".htmlspecialchars($this->MyValue)."\""
86  ." size=\"".$this->MyLength."\""
87  ." maxlength=\"".$this->MyMaxLength."\""
88  .($DisplayErrorIndicator ? " style=\"background-color: #FFEEEE;\"" : "")
89  ." />");
90  }
91 
94  # ---- PRIVATE INTERFACE -------------------------------------------------
95 
96  private $MyLength;
97  private $MyMaxLength;
98 }
99 
Length($NewVal=NULL)
Get or set the display length for this field.
Generator for HTML form fields.
Definition: FormField.php:14
MaxLength($NewVal=NULL)
Get or set the maximum input length for this field.
Abstraction for password forms.
Generator for text input fields.
PrintInput($DisplayErrorIndicator=FALSE)
Generate HTML for this object.
__construct($Name, $IsRequired, $Label, $Length, $MaxLength, $ValidFunc=NULL, $ValidMsgs=NULL)
Object Constructor.