Accessing QF_date elements from javascript (2nd and last try :)

From: Date: Wed, 19 May 2004 14:30:21 +0000
Subject: Accessing QF_date elements from javascript (2nd and last try :)
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12608@lists.php.net to get a copy of this message
I sent this message three days ago, but got no replies... I'm trying again, then I'll shut up :) ----- 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 for JS variables) 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.

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