| Author |
How to add items in the dropdown list dynamically on radio button selection
|
Soni Agrawal
Greenhorn
Joined: May 26, 2008
Posts: 6
|
|
I have a query related to Java Script as i am very new to JavaScript. My Problem is... i have created a group of radio button,1.new car 2.old car onclick event i want to fetch some data from database and display in the dropdown list box corresponding to new car and old car...as i have tested that data is fetched from database correctly but cudn't display in the drop down list box on the click event of radio buttons. [ May 27, 2008: Message edited by: Soni Agrawal ]
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
You either need to postback the page by submitting a form or you have to load the data with Ajax. Eric
|
 |
Soni Agrawal
Greenhorn
Joined: May 26, 2008
Posts: 6
|
|
i m not using any submit button for radio buttons,i m getting data from database thru query that is written in a separate java file..so for every radio button selection,i m creating an object of that java class and calling different different functions according to selection.. actually i m new to javaScript,may be there will be any syntex problem that i m facing..please try to solve my problem
|
 |
Soni Agrawal
Greenhorn
Joined: May 26, 2008
Posts: 6
|
|
|
And the dropdown listbox will be on the same page itself.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
In order to get that query you have to postback the form. It can be done the classic way [requires the page to refresh and uses onclick with document.formName.submit();] or the Ajax way [does not cause the page to refresh] as I stated before. Eric
|
 |
Soni Agrawal
Greenhorn
Joined: May 26, 2008
Posts: 6
|
|
|
on submit() what function i have to call
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56185
|
|
You can find a good starting tutorial on Ajax in this article. As you can see, it's more than just any function that you need to call.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56185
|
|
Please be sure to take the time to compose descriptive subjects for your posts; read this for more information. This entire forum is devoted to solving JavaScript problems so "JavaScript problem" isn't a very effective title. You can go back and change your post to add a more meaningful subject by clicking the .
|
 |
 |
|
|
subject: How to add items in the dropdown list dynamically on radio button selection
|
|
|