This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes correct Ajax script syntax for second DropDown Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "correct Ajax script syntax for second DropDown" Watch "correct Ajax script syntax for second DropDown" New topic
Author

correct Ajax script syntax for second DropDown

Zubi Pen
Greenhorn

Joined: Oct 24, 2007
Posts: 26
Hello eveyone,

I am new to Ajax and have been fiddling with it for the last couple of days. I am trying to get a dropdown filter to work. I have managed to sort out the filter for the frist dropdown using a Ajax script but cannot get the second drop down to work. I am not too sure to write the correct Ajax syntax. My question is on the second dropdown, how can I pass the id for the first onChange event and the second onChange event...

Here is my explanation on what I am trying to achieve,

When a user selects Student Name from the frist dropDown, then the onchange event runs the Ajax script
and filters the second Dropdown and displays all the exams details by the student name selected above. The code works fine uptill this point.

Now, when I select the second dropdown, I want it to take the value of the frist dropdown and the second dropdown and
then filter the third dropdown. I do not know the correct syntax in Ajax on how to pass the onChange event on the frist two dropdowns.

Here is my html dropdown code:

Here is the Ajax script I am using:

Here is the dropdownlist.jsp page that runs the Ajax and gets the values for the second dropdown..

My Question is how can I write the correct syntax for running the Ajax script on the onChage event of the
second dropdown?
[ March 28, 2008: Message edited by: Bear Bibeault ]
Zubi Pen
Greenhorn

Joined: Oct 24, 2007
Posts: 26
Ok no reply so far! I think my post is a bit confusing. Let me explain from a different approach. I am using Using the rico.js file , I have the following script:


This passes "ajaxStudentID" to the file dropdownlist.jsp at the onChange event of the dropdownlist and filters the dropdown list below were div id = "examDropDownList". How can do the same filtering above but this time passing two values so the original "ajaxStudentID" and the onChange "value" of the second downdown, in order to filter the third dropdown.
Patricia Samuel
Ranch Hand

Joined: Sep 12, 2007
Posts: 300
Zubi,

In your last post i ask you how you are implementing AJAX. See use a correct framework can help you in solving all the problems for AJAX. Just implement DWR framework for implementing ajax.
Please tell me are you using struts in you application.

Regards
Patricia Samuel
Ranch Hand

Joined: Sep 12, 2007
Posts: 300
Zubi

go through this link
http://www.javaworld.com/javaworld/jw-06-2005/jw-0620-dwr.html
and let me know if you face any problem implementing dwr in your application.

Thanks
vinod kalghatgi
Greenhorn

Joined: Jun 09, 2008
Posts: 3
[Edit: thread hi-jack removed. Please post your own questions in a new topic.]
[ June 09, 2008: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: correct Ajax script syntax for second DropDown
 
Similar Threads
getting this Ajax code to work with jsp
how to preselect value in dropdownlist in jsp struts
problem in select
OnChange not firing
Strut-Ajax - display states when Country selected