Re: how to use HTML_AJAX for dynamic drop menu creation
| From: | Joshua Eichorn | Date: | Mon, 24 Apr 2006 15:26:19 +0000 |
| Subject: | Re: how to use HTML_AJAX for dynamic drop menu creation | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23818@lists.php.net to get a copy of this message | ||
Octavi Fors wrote:
Josh and everybody,-joshWell this is really just pure JavaScript at this point. <select id="Cities"></select> <input id="CitiesBox" style="display:none"> var callbacks = { getStates: function(result) {yes, it worked fine. Now the drop menu and input box controls appear and disapear depending the value in 'States' (now renamed as 'PAISUVPREV') drop menu. Thanks a lot! Now I would like to duplicate this set of controls (parent drop menu + secondary drop menu or input box controls) in the same webpage form. To avoid idname confusion, I added a numeric index suffix ('_1','_2') to the former controls. I am passing this index in the getUniv call, but I'm getting it with 'undefined' value (see source below). In my case, index value is assigned the first time the form is generated by PHP script. Is there any option in HTML_AJAX for passing a parameter to JS callback code which handles result? The callback gets just 1 parameter which is the results from PHP, you just need to return the index from the PHP side since thats where the second parameter is getting sent._fillInMenu("States", result);}, getCities: function(result) {if (result == false) { document.getElementById('Cities').style.display = 'none'; document.getElementById('CitiesBox').style.display = 'inline'; } else { document.getElementById('Cities').style.display = 'inline'; document.getElementById('CitiesBox').style.display = 'none';_fillInMenu("Cities", result); }} } Updating the callback to something like that should do it. -josh