开发者

How to get a value from a radio-buttons' collection

I was able to get the value from an input type=text with code like this:

$salad_size = $form->addField('line','salad');

$salad_button->js('click')->univ()->ajaxec( array( $this->api->getDestinationURL(), 'generate_salad'=>true, 'salad_size'=>$salad_size->js()->val(), ));

Now I need to get a value from any out of three radio-buttons. This is the object construction: $salad_size = $开发者_运维百科form->addField('radio','salad_size')->setValueList(array('S'=>'Chica','M'=>'Mediana','L'=>'Grande'));

I'd like to know which exactly is the method name to use instead of 'val()' (as it looks not to be the right one for radios).

I was unable to get the methods list from the API reference page here. Any other source of avail methods?

TIA


Have you tried is(':checked') instead of val() ?


Have a look at the agiletoolkit radio button demo page

For the radio button it has the following example

$p=$this;
$values=array('M'=>'Male','F'=>'Female');

$f=$p->add('Form');
$f->addField('line','name');
$f->addField('radio','gender')
  ->setValueList($values)
  ->setNotNull();
$f->addSubmit();

if($f->isSubmitted()){
  $f->js()->univ()->alert($f->get('name').', you are a '.$values[$f->get('gender')])->execute();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜