QuickForm problem with checkboxes (bug?)
| From: | Patrick Schuster | Date: | Thu, 03 Jul 2003 07:47:54 +0000 |
| Subject: | QuickForm problem with checkboxes (bug?) | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-6424@lists.php.net to get a copy of this message | ||
Hi,
there is strange problem and I don't know if it's a bug.
I've two Quickforms on the same a own instance of quickform each.
On the first form there are many fields and one checkbox with the name
'visible'. The second form is just for testing and there are one
textfield and one submit button.
The defaultsValues for the (first) form are generated from the database.
- When I access the page, edit the first form (with the checkbox)
everything is fine (i can e.g. switch the checkbox on/off and this value is
written correct to the database). I can repeat this as many times as I want
and everything is okay.
- But when I edit the second form and press "submit" (I get the same
page again) the first form is filled with the defaultValues fresh from
the database (as expected) but only the checkbox value is wrong because it's
not
checked (although the database value for the checkbox is unmodified
set to checked). I use the type enum('0','1') with default setting '1'
in
the DB and for the testcase I've set this value really to '1'..
I've printed out the defaultValues before setting and they are exactly
the same for the first run and after submitting the second form (my checkbox
element IS '1'). I've also printed out the $_REQUEST array and there is no
appearance of any key/value of the first form so I supposed that *only* the
default values are used to display the first form.
I have no duplicate names in both forms.
The only thing I find out is that it could have something to do with the
function "onQuickFormEvent" in checkbox.php, as I've done a manually
$this->setChecked($arg); just before the "return" and I get the checkbox
checked (but maybe this is the wrong place). But this could not only be the
solution as in this case the checkbox is checked independently from the
value in the DB.
What I want to mention us, that I don't want to use "Advance Checkbox" as
there is JS in it. And I think I've no preoblem with the checkbox element if
it's not checked (as I've process this case manually).
Could you imagine what's wrong here?
Thanks in advance
bye
Patrick