Solved

Submit form to ajax from onChange (Select box)

Posted on 2012-04-12
2
244 Views
Last Modified: 2012-04-12
I have a page with an ajax function on which works absolutely fine. I click on the submit button and it executes my ajax code no problem with the following code ..

onsubmit="ajaxQuote('ajaxQuoteCalculation.asp',this);"

I am picking up the form variables in the ajax function with:

      str = 'leaseAmount=' + frm.leaseAmount.value + '&payYears=' + frm.payYears.value + '&sendMail=' + frm.sendMail.value + '&school=' + frm.school.value  + '&freq=' + frm.freq.value + '&description=' + frm.description.value

and then closing the ajax function with:

   xmlHttp.open("POST",SaveURL,true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", str.length);
    xmlHttp.setRequestHeader("Connection", "close");

****************************************************************
I need to be able to trigger the ajax function whenever a value is changed in one of the drop down select boxes  and also when the main value (in a text box) is changed. It must recalculate on any change made. How do I do this?
0
Comment
Question by:Laride
2 Comments
 
LVL 23

Accepted Solution

by:
basicinstinct earned 300 total points
ID: 37836477
add this to your selects

onchange="ajaxQuote('ajaxQuoteCalculation.asp',this.form);"
0
 

Author Closing Comment

by:Laride
ID: 37838578
Thanks .... I was just    '.form'  off the correct solution myself!

works a treat.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now