Re: Quickform Builder + Smarty
| From: | Justin Patrin | Date: | Tue, 26 Oct 2004 16:31:51 +0000 |
| Subject: | Re: Quickform Builder + Smarty | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15123@lists.php.net to get a copy of this message | ||
On Tue, 26 Oct 2004 08:26:29 -0500, Sparacio, Sal
<salsparacio@newton-associates.com> wrote:
> I am on the last steps on this adventure with Dataobjects + Quickform +
> Smarty. [ I am def going to write some docs after this. :) ] Thanks for
> everyone's help.
Please mention that you're using FormBuilder. I never know from many
peoples' e-mails if they are or aren't as they don't mention it.
>
> Last little things, which are kind of big..
>
> I am trying to get smarty to output the Submit button.
>
> Everything else outputs except that, I have tried {$form_data.submit.html}
> .. and all variations of submit, submitbutton .. etc.
>
__submit__, but you knew that already.
> Code to assign to smarty:: $tpl->assign('form_data', $renderer->toArray());
>
> For the rest of the fields I am using {$form_data.collumname.html} for the
> fields and {$form_data.collumname.label} for the labels, now when I did this
> on the QF that I did
> manually it would put the red star(*) behind the labels. Now, when theses
> forms don't go to smarty they show up right, with the correct labels ( the
> red * and the correct spelling).
>
This isn't put into the label for you as it's assumed you want to do
it yourself. Assuming you're using the ArraySmarty renderer, looks
like the "required" attribute is part of the element. As in:
{if $form_data.column.required}<span style="color: red;">*</span>{/if}
> Last thing I am not getting is I need some of the fields to be radio buttons
> instead of regular text boxes. Should I use something like:
> preGenerateForm?? If so I don't know how to use it, if someone could show an
> example that would be awesome.
Well...there is no easy way for FB to auto-create radio buttons for
you out of text fields. Why are you converting a text field to a radio
button? Or perhaps it's multiple radio buttons?
The best way to do this should be using fb_preDefElements in
preGenerateForm in the DO.
function preGenerateForm(&$fb) {
$this->fb_preDefElements['column'] =
HTML_QuickForm::createElement('radio', 'column', etc.);
}
>
> Just a recap of what I am looking for
>
> Submit Buttons threw smarty
> Correct labels + red starts (*) to denote that they are required
> Some fields to be radio buttons.
>
--
paperCrane --Justin Patrin--