CWIS Developer Documentation
TextFormField.php
Go to the documentation of this file.
1 <?PHP
2 
8 class TextFormField extends FormField {
9 
10  # ---- PUBLIC INTERFACE --------------------------------------------------
11 
14 
26  function TextFormField(
27  $Name, $IsRequired, $Label, $Length, $MaxLength,
28  $ValidFunc = NULL, $ValidMsgs = NULL)
29  {
30  $this->MyLength = $Length;
31  $this->MyMaxLength = $MaxLength;
32 
33  $this->FormField($Name, $IsRequired, $Label, $ValidFunc, $ValidMsgs);
34  }
35 
40 
46  function Length($NewVal = NULL) { return $this->GetOrSet("MyLength", $NewVal); }
47 
53  function MaxLength($NewVal = NULL) { return $this->GetOrSet("MyMaxLength", $NewVal); }
54 
59 
64  function PrintInput($DisplayErrorIndicator = FALSE)
65  {
66  print("<input type=\"".
67  # (hack to support PasswordFormField object as well)
68  (method_exists($this, "PasswordFormField") ? "password" : "text")
69  ."\""
70  ." name=\"".$this->MyName."\""
71  ." value=\"".htmlspecialchars($this->MyValue)."\""
72  ." size=\"".$this->MyLength."\""
73  ." maxlength=\"".$this->MyMaxLength."\""
74  .($DisplayErrorIndicator ? " style=\"background-color: #FFEEEE;\"" : "")
75  ." />");
76  }
77 
80  # ---- PRIVATE INTERFACE -------------------------------------------------
81 
82  private $MyLength;
83  private $MyMaxLength;
84 }
85 
86 
87 ?>