php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23763 button value incorrect after validate()
Submitted: 2003-05-22 17:41 UTC Modified: 2003-05-28 11:32 UTC
From: nlenz at ivcf dot org Assigned:
Status: Closed Package: PEAR related
PHP Version: 4.3.1 OS: Linux
Private report: No CVE-ID: None
 [2003-05-22 17:41 UTC] nlenz at ivcf dot org
Run this test, enter "@#$^" into the test field.
After submitting the form, the reset button's value is "Submit" instead of "Reset".

This is in QuickForm 3.0beta2

<pre>
$form = new HTML_QuickForm('testform', 'post');

$form->setDefaults(array('test'=>'This is a test'));

$form->addElement('text','test','Testing Field:');

$buttons[] = &HTML_QuickForm::createElement('submit', null, 'Submit');
$buttons[] = &HTML_QuickForm::createElement('reset', null, 'Reset');
$form->addGroup($buttons, 'buttons_');

$form->addRule('test','Test must be alphanumeric','alphanumeric');

if ($form->validate()) {

    $form->freeze();
}

$form->display();
</pre>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-23 02:54 UTC] avb@php.net
This problem will appear only when creating unnamed elements in a named group. The fix will be either to give names to submit and reset buttons
<?php
$buttons[] = &HTML_QuickForm::createElement('submit', 'subbutton', 'Submit');
$buttons[] = &HTML_QuickForm::createElement('reset', 'resbutton', 'Reset');
$form->addGroup($buttons, 'buttons_');
?>
or not to give a name to a group
<?php
$buttons[] = &HTML_QuickForm::createElement('submit', null, 'Submit');
$buttons[] = &HTML_QuickForm::createElement('reset', null, 'Reset');
$form->addGroup($buttons);
?>

 [2003-05-28 11:32 UTC] mansion@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php

This is now fixed in release 3.0RC1.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 01 19:03:37 2021 UTC