Re: Quickform Builder + Smarty

From: Date: Tue, 26 Oct 2004 20:57:33 +0000
Subject: Re: Quickform Builder + Smarty
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-15139@lists.php.net to get a copy of this message
On Tue, 26 Oct 2004 15:28:27 -0500, Sparacio, Sal <salsparacio@newton-associates.com> wrote: > > > ok, Justin help me out of this one and you got something good coming from > your list.. > Luckily, this is a simple fix due to a recent change I made to FB. > I am still trying to get theses radio button groups in.. > > I have in my table class:: > > function preGenerateForm(&$fb) > { > $this->preDefElements = array(); > $this->fb_preDefElements['subject_appears'] = > &HTML_QuickForm::createElement('radio', 'subject_appears', > 'subject_appears', 'Occupied', 'occupied'); > > $this->fb_preDefElements['subject_appears'] = > &HTML_QuickForm::createElement('radio', 'subject_appears', > 'subject_appears', 'Vacant', 'vacant'); $this->fb_preDefElements['subject_appears'] = array(&HTML_QuickForm::createElement('radio', 'subject_appears', 'subject_appears', 'Occupied', 'occupied'), &HTML_QuickForm::createElement('radio', 'subject_appears', 'subject_appears', 'Vacant', 'vacant')); > > } > > and debug from smarty is returning this:: > > subject_appears => Array (1) > vacant => Array (8) > name => subject_appears > value => vacant > type => radio > frozen => > required => > error => empty > label => \t subject_appears\r\n\t \t > html => <input name="subject_appears" value="... > > its just returning the 2nd one.. I am using > {$form_data.subject_appears.html} and I get nothing > I use {$form_data.subject.appears.vacant.html} and I get the label + the > button. so I know I gotta be close. Try the above and see what you get. Those two elements will be in a group with the name of the element...at least they should be. > > I have tried about everything else that I have seen on the net.. hope you > can help me out. > Please reply with an example on how to do it & smarty examples. > > I am using DataObject_Formbuilder (latest stable ) + Smarty. FB isn't stable yet, but that's ok. ;-) > > -- Sal > > -----Original Message----- > From: Justin Patrin [mailto:papercrane@gmail.com] > Sent: Tuesday, October 26, 2004 12:06 PM > To: Sparacio, Sal > Cc: pear-general@lists.php.net > Subject: Re: [PEAR] Quickform Builder + Smarty > > > On Tue, 26 Oct 2004 11:53:39 -0500, Sparacio, Sal > <salsparacio@newton-associates.com> wrote: > > > > > > Thanks justin you saved my ass, is there a donate button somewhere? :) > > Not per-se, but I do have a wishlist: > http://pear.php.net/wishlist.php/justinpatrin > I have items ranging from cheap to super-pricey. ;-) > > > > > Last thing I that i need to work out is how to add rules to the form. > > $form->addRule(...); > > http://pear.php.net/manual/en/package.html.html-quickform.html-quickform.addrule.php > > > > > -- Sal > > > > -----Original Message----- > > From: Justin Patrin [mailto:papercrane@gmail.com] > > Sent: Tuesday, October 26, 2004 11:32 AM > > To: Sparacio, Sal > > Cc: pear-general@lists.php.net > > Subject: Re: [PEAR] Quickform Builder + Smarty > > > > > > 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-- > > -- > paperCrane --Justin Patrin-- !DSPAM:417eb46f298411907612276! -- paperCrane --Justin Patrin--

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