Re: QuickForm: How do I append a comment/note

From: Date: Fri, 28 Nov 2003 13:38:21 +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-9206@lists.php.net to get a copy of this message
<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. Bertrand Mansion Mamasam

« previous php.pear.general (#9206) next »