RE: [PEAR] Question: QuickForm IT_Static & hierselect

From: Date: Thu, 30 Oct 2008 08:03:09 +0000
Subject: RE: [PEAR] Question: QuickForm IT_Static & hierselect
References: 1 2 3 4 5 6  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-29382@lists.php.net to get a copy of this message
Alexey, Could you please explain how I would use the extended class below? Do I create a new element like $form->addElement('MyHierselect') or do I use it statically somehow? (Btw, I tried the above method, but I got an 'element not registered' error). Cheers, Michael. -----Original Message----- From: Alexey Borzov [mailto:borz_off@cs.msu.su] Sent: Wednesday, October 29, 2008 11:55 PM To: Michael Mussulis Cc: pear-general@lists.php.net Subject: Re: [PEAR] Question: QuickForm IT_Static & hierselect Hi. Michael Mussulis wrote: > I am sorry, but I don't understand what u mean by hacking hierselect + > accept() - do you have an example by any chance? I don't think playing with > the separators will accomplish my needs which are something like: > > <tr><td>{label1}</td><td><select 1></td></tr> > <tr><td>{label2}</td><td><select 2></td></tr> Well, that leaves us with changing the accept() method. I meant doing something along the lines of class MyHierselect extends HTML_QuickForm_hierselect { function accept(&$renderer, $required = false, $error = null) { HTML_QuickForm_group::accept($renderer, $required, $error); } } although looking now at the source, it won't quite work. You'll need also to output javascript that is now generated in toHTML() method, this will require a new accept() method based on group's accept() and hierselect's toHtml(). > -----Original Message----- > From: Alexey Borzov [mailto:borz_off@cs.msu.su] > Sent: Wednesday, October 29, 2008 11:22 PM > To: Michael Mussulis > Cc: 'pear-general@lists.php.net' > Subject: Re: [PEAR] Question: QuickForm IT_Static & hierselect > > Hi Michael, > > Please reply to the list, other people may also be interested in your > problem. > > Michael Mussulis wrote: >> That' fine, it works but it's not what I am looking for. >> I want to render each of the selects separately, and that's what I don't >> know how to achieve (if possible in the first place). > > You can either hack hierselect to use the same accept() method as group or > play > with separators (that, of course, will work if you aren't trying to put > selects > too far away from each other). > > >> -----Original Message----- >> From: Alexey Borzov [mailto:borz_off@cs.msu.su] >> Sent: Wednesday, October 29, 2008 3:08 PM >> To: Michael Mussulis >> Cc: pear-general@lists.php.net >> Subject: Re: [PEAR] Question: QuickForm IT_Static & hierselect >> >> Hi, >> >> Michael Mussulis wrote: >>> I was just wondering if you could possibly help me figure out how I can >>> render the selects from a 'hierselect' element using IT_Static template? >>> Everything I tried just does not work. >>> >>> My element is: >>> >>> $hs =& $form->addElement('hierselect', 'makemodel', >>> 'Make/Model:', >>> array('class' => 'element'), '&nbsp;'); >>> >>> $hs->setOptions($opts); >>> >>> I output the form as follows: >>> >>> $tpl =& new HTML_Template_ITX(); >>> >>> $tpl->loadTemplateFile('adauga.html'); >>> >>> $renderer =& new HTML_QuickForm_Renderer_ITStatic($tpl); >>> >>> $form->accept($renderer); >>> >>> $tpl->show(); >>> >>> In my html template, I tried: >>> >>> <tr><td class="label">{frmad_makemodel_0_label}</td><td >>> class="element">{frmad_makemodel_0_html}</td></tr> >>> >>> But it doesn't work. Although the documentation says the element is >>> considered a group, IT_Static treats it as an element. >> Yes, exactly, 'date' and 'hierselect' elements are treated like >> "scalar" >> elements for the purposes of rendering. You probably should put >> >> <tr><td class="label">{frmad_makemodel_label}</td><td >> class="element">{frmad_makemodel_html}</td></tr> >> >> into your template. >> > > >

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