Re: QuickForm: How do I append a comment/note
| From: | Stefan Neufeind | Date: | Fri, 28 Nov 2003 14:27:11 +0000 |
| Subject: | Re: QuickForm: How do I append a comment/note | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9207@lists.php.net to get a copy of this message | ||
On 28 Nov 2003 at 14:38, Bertrand Mansion wrote:
> <stefan@neufeind.net> wrote :
>
> > On 28 Nov 2003 at 13:08, Alain Williams wrote:
> >
> >> I am building a form with QuickForm. I want to append to the right
> >> hand side of the entry field a few words to quide the user that is
> >> completing the form. So I have:
> >>
> >> $form->addElement('text', 'Branch', 'Branch',
> >> $Branch,
> >> array('size' => 4, 'maxlength' => 4));
> >>
> >> I would like to do something like:
> >>
> >> $form->addGuidance('Branch', 'This is the branch that you
> >> will update');
> >>
> >> OK, addGuidance does not exist, is there some other way of doing
> >> what I want ?
> >
> > There is no "good" way to to it yet, afaik. Only solution that I
> > found: add a static text-element and align both in one row using a
> > group.
> >
> > Maybe someone got a better idea? If not, maybe this "hack" helps
> > you, Alain.
>
> There is a "good" way to do it. Renderers accept an array of labels so
> you can have:
>
> $labels = array('Branch', 'This is the branch that you will update');
> $form->addElement('text', 'Branch', $labels);
>
> After that, you'll have to modify your template, depending on the
> renderer you use to take care of the second label.
>
> I think this is shown in some examples in the docs directory.
>
> But using static is not a bad way neither IMO.
Well, the only thing I dislike about the static texts within groups
is that you need to take care of the groups when accessing the value
of the input element. Therefor your solution might be the better way.
Thanks for enlightment :-) Have a nice weekend,
Stefan