Accessing QF_date elements from javascript
| From: | Cesare D'Amico | Date: | Sun, 16 May 2004 11:01:02 +0000 |
| Subject: | Accessing QF_date elements from javascript | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-12526@lists.php.net to get a copy of this message | ||
Hi all,
here's my problem: I have 2 QF_date elements in a form, I want to
calculate the difference in days every time that one element in a date
widget gets changed (stop, I know that this is JS' job... read on,
please :)
The question: how can I access the QF_date elements directly, so that I
can get their values from the JS handlers for onBlur and onChange?
Here's how I make the date widgets:
$form_prenotazione->addElement('date', 'data_da', 'Check in',
array('language' => 'it', 'format' => 'd F Y',
'minYear' => date('Y'), 'maxYear' => date('Y') + 1));
If I add a fifth parameter with something like:
array('id'=>'data_da', 'onChange'=>'calcDates()')
all three <SELECT>s in the widget get the same ID, so I cannot access
them with document.getElementById(). The names of the <SELECT>s are
"data_da[d]", "data_da[F]", "data_da[Y]" (which are incorrect names in
JS) so I can't get the values by document.forms[0].widget_name either.
"pear info HTML_QuickForm" says that I'm using "HTML_QuickForm-3.2".
Any idea? Thanks for your attention :)
Ciao
ce
--
Cesare D'Amico - ce (@t) cesaredamico (dot) com
http://cesaredamico.com ~ http://phpday.it ~ http://verona.linux.it/
Key on pgp.mit.edu, ID 92802693.