Changeset 1104
- Timestamp:
- 09/30/08 16:46:34 (3 months ago)
- Files:
-
- trunk/lib/jelix/CREDITS (modified) (1 diff)
- trunk/lib/jelix/plugins/jforms/html/html.jformsbuilder.php (modified) (1 diff)
- trunk/lib/jelix/plugins/jforms/htmllight/htmllight.jformsbuilder.php (modified) (1 diff)
- trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html_cli.php (modified) (1 diff)
- trunk/testapp/modules/jelix_tests/tests/jforms.htmllightbuilder.html_cli.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/jelix/CREDITS
r1103 r1104 35 35 - jForms: Add support of the required attribute on <checkbox> (#635) 36 36 - fixes about table_prefix in jDb (#702, #703) 37 - jForms: radiobutton with value 0 should not get selected by default (#691) 37 38 38 39 Bastien Jaillot (aka bastnic) trunk/lib/jelix/plugins/jforms/html/html.jformsbuilder.php
r1081 r1104 332 332 $value=''; 333 333 } 334 $value = (string) $value; 334 335 $span ='<span class="jforms-radio jforms-ctl-'.$ctrl->ref.'"><input type="radio"'; 335 336 foreach($ctrl->datasource->getData($this->_form) as $v=>$label){ 336 echo $span,$id,$i,'" value="',htmlspecialchars($v),'"',( $v==$value?' checked="checked"':''),$readonly,$class,$this->_endt;337 echo $span,$id,$i,'" value="',htmlspecialchars($v),'"',((string) $v===$value?' checked="checked"':''),$readonly,$class,$this->_endt; 337 338 echo '<label for="',$this->_name,'_',$ctrl->ref,'_',$i,'">',htmlspecialchars($label),'</label></span>'; 338 339 $i++; trunk/lib/jelix/plugins/jforms/htmllight/htmllight.jformsbuilder.php
r1081 r1104 331 331 $value=''; 332 332 } 333 $value = (string) $value; 333 334 $span ='<span class="jforms-radio jforms-ctl-'.$ctrl->ref.'"><input type="radio"'; 334 335 foreach($ctrl->datasource->getData($this->_form) as $v=>$label){ 335 echo $span,$id,$i,'" value="',htmlspecialchars($v),'"',( $v==$value?' checked="checked"':''),$readonly,$class,$this->_endt;336 echo $span,$id,$i,'" value="',htmlspecialchars($v),'"',((string) $v===$value?' checked="checked"':''),$readonly,$class,$this->_endt; 336 337 echo '<label for="',$this->_name,'_',$ctrl->ref,'_',$i,'">',htmlspecialchars($label),'</label></span>'; 337 338 $i++; trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html_cli.php
r1099 r1104 470 470 jFormsJQ.tForm.addControl(c); 471 471 ', $this->builder->getJsContent()); 472 472 473 $this->builder->clearJs(); 474 475 $ctrl->datasource = new jFormsStaticDatasource(); 476 $ctrl->datasource->data = array('1'=>'Yes','0'=>'No'); 477 $this->form->setReadOnly('rbchoixsimple',false); 478 $this->form->setData('rbchoixsimple',null); 479 ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 480 $result='<span class="jforms-radio jforms-ctl-rbchoixsimple"><input type="radio" name="rbchoixsimple" id="'.$this->formname.'_rbchoixsimple_0" value="1"/><label for="'.$this->formname.'_rbchoixsimple_0">Yes</label></span>'; 481 $result.='<span class="jforms-radio jforms-ctl-rbchoixsimple"><input type="radio" name="rbchoixsimple" id="'.$this->formname.'_rbchoixsimple_1" value="0"/><label for="'.$this->formname.'_rbchoixsimple_1">No</label></span>'; 482 $this->assertEqualOrDiff($result, $out); 483 484 $this->form->setData('rbchoixsimple',0); 485 ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 486 $result='<span class="jforms-radio jforms-ctl-rbchoixsimple"><input type="radio" name="rbchoixsimple" id="'.$this->formname.'_rbchoixsimple_0" value="1"/><label for="'.$this->formname.'_rbchoixsimple_0">Yes</label></span>'; 487 $result.='<span class="jforms-radio jforms-ctl-rbchoixsimple"><input type="radio" name="rbchoixsimple" id="'.$this->formname.'_rbchoixsimple_1" value="0" checked="checked"/><label for="'.$this->formname.'_rbchoixsimple_1">No</label></span>'; 488 $this->assertEqualOrDiff($result, $out); 489 490 $this->builder->clearJs(); 473 491 } 474 492 trunk/testapp/modules/jelix_tests/tests/jforms.htmllightbuilder.html_cli.php
r1099 r1104 470 470 jForms.tForm.addControl(c); 471 471 ', $this->builder->getJsContent()); 472 472 473 $this->builder->clearJs(); 474 475 $ctrl->datasource = new jFormsStaticDatasource(); 476 $ctrl->datasource->data = array('1'=>'Yes','0'=>'No'); 477 $this->form->setReadOnly('rbchoixsimple',false); 478 $this->form->setData('rbchoixsimple',null); 479 ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 480 $result='<span class="jforms-radio jforms-ctl-rbchoixsimple"><input type="radio" name="rbchoixsimple" id="'.$this->formname.'_rbchoixsimple_0" value="1"/><label for="'.$this->formname.'_rbchoixsimple_0">Yes</label></span>'; 481 $result.='<span class="jforms-radio jforms-ctl-rbchoixsimple"><input type="radio" name="rbchoixsimple" id="'.$this->formname.'_rbchoixsimple_1" value="0"/><label for="'.$this->formname.'_rbchoixsimple_1">No</label></span>'; 482 $this->assertEqualOrDiff($result, $out); 483 484 $this->form->setData('rbchoixsimple',0); 485 ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 486 $result='<span class="jforms-radio jforms-ctl-rbchoixsimple"><input type="radio" name="rbchoixsimple" id="'.$this->formname.'_rbchoixsimple_0" value="1"/><label for="'.$this->formname.'_rbchoixsimple_0">Yes</label></span>'; 487 $result.='<span class="jforms-radio jforms-ctl-rbchoixsimple"><input type="radio" name="rbchoixsimple" id="'.$this->formname.'_rbchoixsimple_1" value="0" checked="checked"/><label for="'.$this->formname.'_rbchoixsimple_1">No</label></span>'; 488 $this->assertEqualOrDiff($result, $out); 489 490 $this->builder->clearJs(); 473 491 } 474 492
