Re: QuickForm hierselect get last value with javascript

From: Date: Fri, 17 Jun 2011 16:24:10 +0000
Subject: Re: QuickForm hierselect get last value with javascript
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-31140@lists.php.net to get a copy of this message
Hi Zoltan, On 17.06.2011 19:48, Köteles Zoltán wrote:
How can I get the last selected value with javascript in QuickForm hierselect? Example I have 3 select box with hierselect. If I change the first select I'd like to run my ajax script with the second selected option value. If I change the second select I'd like to run my ajax script with the third selected option value. And so on... I don't know how many selects are in the hierselect (maybe only 2, but sometimes 3 or 4 or more) How can I do that?
It is hard to do with HTML_QuickForm, hierselect there was not designed for plugging in user-defined stuff. Consider switching to HTML_QuickForm2, hierselect there allows setting JS callback which will provide options for subsequent selects when current one changes. There is an example (hierselect-ajax.php) that is installed with the package and shows how to do it.

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