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

Bug #5644 Client javascript validation of single radio box fails
Submitted: 2005-10-10 13:07 UTC
From: martin at bymartin dot com Assigned: avb
Status: Closed Package: HTML_QuickForm
PHP Version: Irrelevant OS: freeBSD
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 39 + 30 = ?

 
 [2005-10-10 13:07 UTC] martin at bymartin dot com
Description: ------------ When you have a radio box with only one radio option the client javascript validation always reports that the item is not selected. If you disable client validation in the "required" form rule the form validates OK. Or if you add a second radio box (with the same name) the client javascript validated the form correctly to. Test script: --------------- <?php // Load the main class require_once 'HTML/QuickForm.php'; // Instantiate the HTML_QuickForm object $form = new HTML_QuickForm('firstForm'); // Set defaults for the form elements $form->setDefaults(array( 'name' => 'Joe User' )); // Add some elements to the form $form->addElement('header', null, 'QuickForm tutorial example'); $form->addElement('text', 'name', 'Enter your name:', array('size' => 50, 'maxlength' => 255)); $form->addElement('radio','Radio','Radio: ','first and only radio box','test'); //$form->addElement('radio','Radio','Radio: ','second radio box','test2'); $form->addElement('submit', null, 'Send'); // Define filters and validation rules $form->applyFilter('name', 'trim'); $form->addRule('name', 'Please enter your name', 'required', null, 'client'); $form->addRule('Radio', 'Please check radio box', 'required', null, 'client'); // Try to validate a form if ($form->validate()) { echo '<h1>Hello, ' . htmlspecialchars($form->exportValue('name')) . '!</h1>'; exit; } // Output the form $form->display(); ?> Expected result: ---------------- When you select Radio the form should validate OK. Actual result: -------------- The form always failes.

Comments

 [2005-11-01 11:30 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!
 [2006-06-18 17:06 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!