Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-24-2007, 04:09 PM
Junior Member
 
Join Date: Oct 2007
Posts: 2
Default radioForm

I'm using the initial helpers to create a set of radio buttons, such as:

<?= $this->formRadio('pg1_3', $this->formObj->pg1_3, null, array(1=>' Yes',2=>' No'),'&nbsp;')?>

creates:

<input name="pg1_3" value="" type="hidden"><label style="white-space: nowrap;"><input name="pg1_3" value="1" type="radio"> Yes</label>&nbsp;<label style="white-space: nowrap;"><input name="pg1_3" value="2" type="radio"> No</label>

Upon submitting this form, the controller extracts the "hidden" value, which is "". How can I get the value from the radio button that the user selected in the controller, such as $this->_request->getPost('pg1_3'). It extracts a blank string because that is the value of the hidden field which has SAME name as the radio button. Please help.

-Scott
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-24-2007, 04:16 PM
Junior Member
 
Join Date: Oct 2007
Posts: 2
Default

Sorry, it appears that I had a typo in my controller code. I am able to extract the param with $this->_request->getPost('pg1_3'). One question, however, why is the hidden form created along with the radio button?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-25-2007, 08:25 AM
Junior Member
 
Join Date: Sep 2007
Posts: 10
Default

Hi sclaerhout.

At the first thought I think it's because in case a radio button is not selected you would still have the post var "pg1_3". If a radio button is not selected then it will not send a variable in the POST. Same applies with checkboxes. If a checkbox is not selected the variable is not created.

Adrian
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 01:07 AM.