[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pear-general
Subject:    Re: [PEAR] quickform : setChecked doesn't work
From:       pear () elfloridita ! net
Date:       2006-12-30 9:20:29
Message-ID: 20061230102029.dcpq4cjq8kgsok4c () webmail ! elfloridita ! net
[Download RAW message or body]

Justin Patrin <papercrane@gmail.com> a écrit :

> On 12/26/06, pear@elfloridita.net <pear@elfloridita.net> wrote:
>> Hi
>>
>> I have a quickform form with two radio input. I want the first one to
>> be checked when the page is loaded.
>>
>> I tried :
>>
>> $radios[] = &HTML_QuickForm::createElement('radio', null, null,
>> 'label1', 'val1', array('class' => 'radio');
>> $radios[] = &HTML_QuickForm::createElement('radio', null, null,
>> 'label2', 'val2', array('class' => 'radio');
>> $radios[0]->setChecked(true);
>> $form->addGroup($radios, 'grp', 'Label');
>>
>> but that doesn't work, nothing's checked.
>>
>> I also tried :
>>
>> $radios[] = &HTML_QuickForm::createElement('radio', null, null,
>> 'label1', 'val1', array('class' => 'radio', 'checked' => 'checked');
>> $radios[] = &HTML_QuickForm::createElement('radio', null, null,
>> 'label2', 'val2', array('class' => 'radio');
>> $radios[0]->setChecked(true);
>> $form->addGroup($radios, 'grp', 'Label');
>>
>> but the checked parameter is ignored (doesn't appear in HTML source)
>>
>>
>>
>>
>> Can someone help me ?
>>
>
> Try using $form->setDefaults().
>
> -- 
> Justin Patrin
>
> -- 
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

That works, thank you

Julien

-- 
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic