Yii Framework Forum: Radio Button - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Radio Button Rate Topic: -----

#1 User is offline   amerrnath 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 22
  • Joined: 26-March 13
  • Location:chennai

Posted 09 April 2013 - 07:36 AM

hi i have a attribute "int gender;" in model and and i have this code in _form.php(view)
 $form->radioButtonList($model,'gender',array(1=>'male',0=>'female'),array('labelOptions'=>array('style'=>'display:inline')));
.

but the gender value is not set while saving oly default 0 is set in database can u tell me how to solve it thanks in advance
0

#2 User is offline   Lal Zada 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 125
  • Joined: 06-November 12
  • Location:Lahore, Pakistan

Posted 09 April 2013 - 07:49 AM

View Postamerrnath, on 09 April 2013 - 07:36 AM, said:

hi i have a attribute "int gender;" in model and and i have this code in _form.php(view)
 $form->radioButtonList($model,'gender',array(1=>'male',0=>'female'),array('labelOptions'=>array('style'=>'display:inline')));
.

but the gender value is not set while saving oly default 0 is set in database can u tell me how to solve it thanks in advance



in your controller action echo radio value to ensure that value is passing correctly ,
i think its ok with form but some problem with saving value to db
Is it fast? Is it secure? Is it professional? Is it right for my next project? Yes, it is

Linkedin Facebook Twitter Google+
0

#3 User is offline   amerrnath 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 22
  • Joined: 26-March 13
  • Location:chennai

Posted 09 April 2013 - 08:16 AM

View PostLal Zada, on 09 April 2013 - 07:49 AM, said:

in your controller action echo radio value to ensure that value is passing correctly ,
i think its ok with form but some problem with saving value to db


thanks i got the bug out thank you so much
0

#4 User is offline   Ghanshyam 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 41
  • Joined: 18-March 13
  • Location:Ahmedabad

Posted 09 April 2013 - 08:35 AM

hi,
You have to set
 $model->gender = 0 

in your controller.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users