Re: Quickform Question in re Groups & Popup Calendar

From: Date: Mon, 25 Aug 2003 17:55:55 +0000
Subject: Re: Quickform Question in re Groups & Popup Calendar
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-7401@lists.php.net to get a copy of this message
On Thursday 21 August 2003 15:46, Bertrand Mansion wrote: > <jkaufman@wamnet.com> wrote : > > Is it possible to create a group that consists of a text field and > > an image such that the text field contains a date and the image if > > clicked will call a Javascript function that pops up a calendar, > > then fills in the date field with the new data. I have this, but it > > doesn't work*: > > > > $text_field = &HTML_QuickForm::createElement('text', > > 'text_field'); > > $image_field = &HTML_QuickForm::createElement('html', " > > <a HREF='#' onClick=\"return > > getCalendar('form.text_field')\"> > > <img SRC='calendar.png' BORDER='0'></a>"); > > $form->addGroup(array($text_field, $image_field), '', 'Meeting > > Date'); > > > > It generates html that looks like: > > > > <a HREF='#' onClick="return > > getCalendar('form.text_field')"> > > <img SRC='calendar.png' BORDER='0'></a> > > <tr> > > <td align="right" valign="top"> <td > > valign="top" > > align="left"><input name="text_field" type="text" > > value="02/10/2003" /></td> > > </tr> > > > > * Doesn't work means: 1) The html code is generated outside of the > > <tr>...</tr> section, so it doesn't appear within the table next to > > the text field. It appears at the top of the page. 2) After > > selecting a date from the popup menu, the text field does not show > > the new value, though the "same" code works outside of Quickform. > > Did you try with a static element instead of a html element ? > > Example: > $image_field = &HTML_QuickForm::createElement('static', 'calBtn', > null, "<a HREF='#' onClick=\"return > getCalendar('form.text_field')\"><img SRC='calendar.png' > BORDER='0'></a>"); > > Bertrand Mansion > Mamasam Very nice. The static type produced the output I wanted. I'm still trying to get the output of the calendar script to update the field on the screen. -- James 'Chip' Kaufman jkaufman@wamnet.com 651-256-5137 PGP key: 697D43DE

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