00001 <?php 00007 class ButtonField extends AbstractField 00008 { 00009 protected $type = 'button'; 00010 00017 public function __construct($name, &$parentForm, array $attribs = array('type' => 'button')) 00018 { 00019 parent::__construct($name, $parentForm, $attribs); 00020 } 00021 00025 public function drawInput() 00026 { 00027 $extra = $this->extrasAsAttributes(); 00028 echo "<input type='$this->type' value='$this->value' $extra/>"; 00029 } 00030 00036 public function __set($name, $value) 00037 { 00038 if ($type == 'type' && !preg_match('/(submit)|(reset)|(button)/', $value)) 00039 throw new InvalidAttributeValueException($value); 00040 00041 parent::__set($name, $value); 00042 } 00043 00044 #### 00045 # All of the following are effective no-ops just to fully implement Field 00046 #### 00047 00051 public function validate() 00052 { 00053 return; #No-Op 00054 } 00055 00060 public function getData() 00061 { 00062 return; #No-Op 00063 } 00064 00069 public function getSqlImpl() 00070 { 00071 return null; #No-Op 00072 } 00073 00078 public function hasError() 00079 { 00080 return false; # Buttons are perfect and never have errors 00081 } 00082 00083 } 00084 ?>