473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Onchange submit the form in javascript

hai,


I have a form in which there is a dropdown list.
When i change the value of dropdown,the form should be submitted and the selected value should be also be passed on form submission.
Depending on the selected value another set of values is displayed.


i donnot know how to do this.


suggestions required.
Aug 31 '10 #1
7 2269
Tawnos
1
So when the dropdown changes the form is submitted which refreshes the page. Sometimes, however, another dropdown is displayed as well?
Aug 31 '10 #2
hai,

yes,Depending on the selected value,another dropdown is populated.
For that ,I want to get the selected id of the first dropdown and submit the form .
Based on the id,values are fetched from the displayed on the second dropdown.

I donotknow ,how to submit the form on onchange and get the selected id and passit to java function.

suggestions req.
Sep 1 '10 #3
kovik
1,044 Expert 1GB
Are you sure that you want to submit the form every time that another option is selected?

You could use AJAX and populate the next dropdown based on the returned data. Or, better yet, place all of the possible values in the original JavaScript and display the dropdowns based on those values. You could use nested arrays to store all of the options.

Submitting the form every time the option is changed seems like overkill since the user will have to wait for the entire page to load again rather than a small AJAX response or no load at all.
Sep 2 '10 #4
hai,

I used ajax to populate the values,but the entire page is written as response in the dropdown.
I donotknow how to write the particular value in the dropdown in ajax.
Sep 2 '10 #5
kovik
1,044 Expert 1GB
So, what you are saying is that submitting the dropdown changes more than just one element? In that case, why do you want to submit it whenever it is changed? What if people make an accidental selection?

I would force them to hit "Submit" to ensure that they are submitting the correct value.
Sep 2 '10 #6
hai,


thanx.

can u tell me how to particular response in the div in contrast to entire page in the div.
Sep 2 '10 #7
kovik
1,044 Expert 1GB
If you only want to update part of a page, you can use AJAX to communicate with the server, and then alter the page according to the server response.

There are lots of tutorials out there on AJAX.
Sep 2 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: vishal | last post by:
hello friends i have one php script which generates html page containing form. what i want is submit this form using php script. pls give me some idea that how can i submit form using php...
2
by: Matt | last post by:
The problem is I have 3 buttons that need to submit the form to different URL. My approach is to declare <input type="submit"> rather than <input type="button">. And put the following in the...
4
by: Slug | last post by:
Hello, I've tried to find this answer, but can't seem to get a clear example - I'm using the following classic asp code to submit a form: <form action="default.asp" name=order method=post> ...
1
by: Matt | last post by:
The problem is I have 3 buttons that need to submit the form to different URL. My approach is to declare <input type="submit"> rather than <input type="button">. And put the following in the...
6
by: tencip | last post by:
Hi everyone, So, i've got a form that is very simple. It hold three elements: username, password, and domain. The goal here is to have the form submit the login to an administrative section...
1
by: Andy Kasotia | last post by:
I have an ASP UI with VB Dll as a COM object that access the DB2 Database. I have a "Calculate" button on the ASP Page which when clicked does form validation (javascript) and submits the form...
2
by: a10392 | last post by:
Hi, I'am triyng to create a form where i have 2 comboBox and 2 textbox, when the selection changes on the first combo , the content of second also changes. i have to use onchange=form.submit() ...
1
by: MZ | last post by:
Hello! Is it possible to change URL form action on submit form... I have tried such code: <script language="JavaScript" type="text/javascript"> function changeURL() {
4
by: auslandt | last post by:
I have an HTML file that includes a JavaScript. I would like this JavaScript to be able to create an "onChange=<function>" attribute against the password element. Here is an example page of the...
1
by: arggg | last post by:
I created a submit form that calls a javascript:AjAX Command that will call the data and submit it without have the page refresh. This works perfect in Firefox however in IE and Opera when the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.