예제 #1
0
 function setValue($val)
 {
     // we are using the assumption that the first "setValue" call will be the value that is desired as the default value. Sometimes,
     // the setValue call happens before the kids exist, so we need to remember the default value so we can select the approproate kid as the default
     // as they are added later on, see WFRadio::allConfigFinishedLoading()
     if (is_null($this->defaultValue)) {
         $this->defaultValue = $val;
     }
     parent::setValue($val);
     foreach ($this->children() as $id => $radio) {
         if ($radio instanceof WFDynamic) {
             continue;
         }
         // special sauce to skip the WFDynamic that created the WFRadio's
         if (!$radio instanceof WFRadio) {
             throw new Exception("All child objects of WFRadioGroup must be WFRadio's.");
         }
         // see if the value being set matches the value of this radio; type check for NULLs
         if (is_null($this->value)) {
             if ($radio->selectedValue() === $this->value) {
                 $this->setSelectedRadio($radio);
                 break;
             }
         } else {
             if ($radio->selectedValue() == $this->value) {
                 $this->setSelectedRadio($radio);
                 break;
             }
         }
     }
 }
예제 #2
0
파일: WFSelect.php 프로젝트: ardell/phocoa
 function setValue($val)
 {
     $this->assertMultiple(false);
     parent::setValue((string) $val);
 }