Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.2.16

Bug #2850 radio buttons do not fill when there is an error
Submitted: 2004-11-29 13:29 UTC
From: jim at whatifnet dot com Assigned:
Status: Bogus Package: HTML_QuickForm
PHP Version: 4.3.8 OS: Linux (Fedora Core 2)
Roadmaps: (Not assigned)    
Subscription  


 [2004-11-29 13:29 UTC] jim at whatifnet dot com
Description: ------------ When a form is created with radio buttons and is filled out incorrectly and submitted, the radio buttons do not auto fill if they were selected when the form was submitted. When a radio button is select and the form is submitted, no radio button in that group will be selected. When no radio button is selected and the form is submitted, the last radio button in that group will be selected. Reproduce code: --------------- <?php require_once 'HTML/QuickForm.php'; $form = new HTML_QuickForm('firstForm', 'post'); $form->addElement('header', null, 'This is a header'); $form->addElement('text', 'firstname', 'First Name:', array('maxlength' => 255)); $form->addElement('text', 'lastname', 'Last Name:', array('maxlength' => 255)); $form->addElement('radio', 'radio', 'Select one:', "Radio Testing"); $form->addElement('radio', 'radio', '', "Radio Test2"); $form->addElement('submit', null, 'Submit'); $form->applyFilter('firstname', 'trim'); $form->addRule('firstname', 'Please enter your first name', 'required', null); if ($form->validate()) { echo 'success'; }else{ echo $form->toHtml(); } ?> Expected result: ---------------- I expect that when a radio button is selected and a form is submitted and it does not validate, that the correct radio button will still be selected. Actual result: -------------- When a radio button is selected and the form does not validate, the correct radio button will not be selected.

Comments

 [2004-11-29 15:59 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2004-11-29 16:26 UTC] jim at whatifnet dot com
I see, thank you for your time!