I am new to scriptaculous but not new to coding. I am having an issue trying to get a change event to fire. Here is the setup I have an xml file listing all of the states and the cities in them. This file is used to create a Scriptaculous Ajax.Autocomplete. I am successfull at getting this to work for the state selection. I am having trouble with the next step. Once a selection is made I want enable the city selector and populate it. My plan was to trace the code to make sure I understand the prototype $A call correctly then if correct create a local autocomplete but the change event on the text control did not fire. I have tried several variants the most current is trying to us the afterUpdateElement option. I have tried setting up an event listner setting a funtion on the onchange event, and many other things I am missing a step but I cant find what it is. Maybe there is something with parmeters I'm lost Help.
Code:
// Java Script File Requires scriptaculous and prototype libraries
//This file provides supporting JavaScript for the dealer network page
var stateText =
{
init:
{
var stateCompleter = new Ajax.Autocompleter("txtState", "state_complete", "PScripts/autoCompleteStateHandler.php", {afterUpdateElement:stateChangeHandler()});
}
}
//Handle the change event for the state text box
function stateChangeHandler(input,item)
{/**************************I am not able to get here ***************************/
//Set up Ajax Request Object
new Ajax.Request(
"PScripts/list_cities.state="+input), //$F will get the value in the txtState control
{
method:"get",
onComplete:function(xhr){
citiesXML=xhr.response.xml;
setCity(citiesXML);
}
}
function setCity(cityData)
{
cityArray = $A(cityData);
}
Core.start("stateText");//This function is from another library it just causes initialization in window.onload
|