Re: QuickForm: Unrelated Grouped Elements
| From: | Dan Wilson | Date: | Thu, 20 Feb 2003 17:47:03 +0000 |
| Subject: | Re: QuickForm: Unrelated Grouped Elements | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-3869@lists.php.net to get a copy of this message | ||
I'd rather not do it that way... and it really should work as I expected it
to. The reason I don't want to do it that way is that all the defaults come
straight out of the database.
I feed the result set from the db right into the setDefaults function. And
the same thing on the save side... I feed the getSubmitValues right into a
function that translates the array into a sql update (or insert).
I'd much rather not have to massage the data like you indicate.
If I can figure out a patch, are you willing to go that direction? Seems that
if you don't give the group a name, then the expected behaviour would be what
I am trying to do.
-Dan
Quoting Bertrand Mansion <bmansion@mamasam.com>:
> <dan@acucore.com> wrote :
>
> > I want to group a few elements on the same line that are unrelated (don't
> > share a name at all), but it appears that if I do this, it doesn't honor
> the
> > default values.
> >
> > Here's my code:
> >
> > $default['status'] = 2;
> > $default['approved'] = 't';
> >
> > $form->setDefaults($default);
> >
> > $status = &HTML_QuickForm::createElement('select', 'status',
> > 'Status:',
> > $GLOBALS['conf']['status_keys']);
> > $status->updateAttributes(array('onChange'=>'setBgColor(this,
> this.value)'));
> > $approved = &HTML_QuickForm::createElement('advcheckbox',
> > 'approved',
> > null, 'Approved?', null, array('t','f'));
> > $form->addGroup(array($status, $approved), null, 'Status:');
> > /*
> > $status = &$form->addElement('select', 'status',
> > 'Status:',
> $GLOBALS['conf']
> > ['status_keys']);
> > $approved = &$form->addElement('advcheckbox', 'approved', null,
> 'Approved?',
> > null, array('t','f'));
> > */
> >
> > If I comment out the top portion and uncomment the bottom, it works, but
> it's
> > not quite what I want.
> >
> > I tried to figure out what the problems was to give a diff, but it's
> escaping
> > me.
>
> Try to give a name to your group instead of null, then modify your default
> array to reflect this change. This way, QuickForm will know where your
> elements are.
>
> Bertrand Mansion
> Mamasam
>
>