[UPHPU] QuickForm and Checkboxes, is it checked? [solved]

Mitch Anderson mitch at metauser.net
Fri Nov 19 12:30:08 MST 2004

On Fri, 2004-11-19 at 09:35 -0700, Mitch Anderson wrote:
> What am I doing wrong?

Well, my logic was a bit messed... I was always assigning it to true or
'checked', so, that has been moved down to the else when the form is
originally displayed...

>From the sample code given, here is how I fixed it:

$form = new HTML_QuickForm('Form');

$checked =& $form->addElement('checkbox', 'check1', NULL, 'CheckMe',
$form->addElement('submit', null, 'Submit');

        $checked = $form->exportValue('check1');

                $ret_array['check1'] = 1;
        } else {
                $ret_array['check1'] = 0;
} else {
	if($data_array['check1'] == 1) { $checked->setChecked(true); }

Mitch Anderson <mitch at metauser.net>

More information about the UPHPU mailing list