Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Ajax
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Ajax the combination of XHTML, CSS, DOM, XML, XSLT, XMLHttpRequest, and JavaScript
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Ajax section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 12th, 2007, 11:11 AM
Registered User
Join Date: Sep 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Request action on change and get no action. Help

I have a problem. I am creating a form on this form there is a need for two autocomplete controls. The first control is the state this is done using scriptaculous and is working fine. The next is city the list of cities is of course dependent on the state. I have tried several variations but I can't get the first control to fire a change event. I have tried many variations but I will include only two here so you can get a feel of what I have tried.

Attempt 1:
I have tried several variations on this theme, set up a listener, use the prototype observe, etc
var txtState =
    var StateElement;

        StateElement = Document.getElementById("txtState");
        StateElement.onchange = StateChangeHandler();


//Handle the change event for the state text box
function stateChangeHandler()
/****************I Can't get here************/
    //Set up Ajax Request Object
    try //Normal Browsers
        var requester = new XMLHTTPRequest();
        try //Microsoft Browsers
            var requester = nex ActiveXObject("Microsoft.XMLHTTP");
        catch(error)//Browser can not use Ajax
            var requester = null;

Attempt 2:
After a while I thought that maybe I could use scriptaculous options this is my current run down that line.
var stateText =


    //Here I took this declaration out of the HTML cleaner this way
        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)
{/******************************* Still Can't get here ***************************/
    //Set up Ajax Request Object
   new Ajax.Request(
      "PScripts/list_cities.state="+input), //$F will get the value in the txtState control

function setCity(cityData)
    cityArray = $A(cityData);

Core.start("stateText");// This is just an window onload listner
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
action script sanjay_yadavhhh4 ActionScript 0 October 22nd, 2008 12:07 AM
Change form ACTION value from checkbox value Nazz Javascript 3 March 10th, 2005 11:50 AM
Two action in a form johnjohn Classic ASP Components 1 November 16th, 2004 05:45 PM
I want button action to change current window drb2k2 JSP Basics 0 June 4th, 2003 06:00 AM

All times are GMT -4. The time now is 03:57 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.