RE: [PEAR] Quickform
| From: | Ian Warner | Date: | Thu, 01 Mar 2007 10:24:14 +0000 |
| Subject: | RE: [PEAR] Quickform | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-26696@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Bertrand Mansion [mailto:golgote@mamasam.com]
> Sent: 01 March 2007 09:24
> To: Ian Warner
> Cc: pear-general
> Subject: Re: [PEAR] Quickform
>
>
> Le 1 mars 07 à 00:38, Justin Patrin a écrit :
>
> > On 2/28/07, Ian Warner <ian.warner@hotxt.net> wrote:
> >> I would like to add a new template element: HELP
> >>
> >>
> >>
> >> This would contain an icon where the user can hover over and get
> >> some help
> >> on that form element.
> >>
> >>
> >>
> >> So I would want to register an element the form generation and
> >> also below
> >> state where I want these outputted.
> >>
> >
> > If you just want to have a help icon beside each element then just
> > change the generic element template.
> >
> > If you want to create a new element that has your content you need to
> > create your own element class.
>
> You could also tweak the default template and use the second label
> (you can have as many labels as you want as long as your template
> knows what to do with them) to display some help information.
> addElement() accepts an array for the label. There must be an example
> somewhere on how to use this.
Hi I tested this and get no output from the array for the labels.
My problem I think is calling the second lablel (or help icon) within my
customer Renderer.
For instance I have - so I have the (help) area defined but how do I
populate that - or indeed a second label? As I said is it even possible to
create new Renderer template areas?
* Var to override the default QuickForm renderer element.
*
* @access public
* @var string $_elementTemplate
*/
public $_elementTemplate = '
<!-- BEGIN error -->
<tr>
<td colspan="3">
<span class="text_red">{error}</span>
</td>
</tr>
<!-- END error -->
<tr>
<td>
{help}
</td>
<th class="form_field">
<!-- BEGIN required -->
<span class="redtext">*</span>
<!-- END required -->
{label}
</th>
<td>
{element}
</td>
</tr>';
I have created this now:
$form->registerElementType('help',
'library/HTML/QuickForm/Elements/HelpIcon.php',
'HTML_QuickForm_Elements_HelpIcon');
$form->addElement('help', null, 'Help ME', 'HelpME');
Based on the static element type - so I could quite easily turn this into a
help icon.
I am bit a bit confused by Justin and your answer, some real world examples
would be nice if available for this.
Will keep plugging away
Cheers
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php