How can I submit a partially-completed form in JavaScript before the user hits the submit button? I want to perform some server-side processing before the user hits the submit button.

Jayesh Nazre

Well that's a very tricky question. I will answer this assuming certain things, for each assumption I will give you a solution.

Assumption 1:
You want to send the partial data to the server, process the partial data and then allow the user to enter the data. The drawback here is that the screen needs to be repainted once again in the browser and you will also have to take care of populating the partial data filled in by the user.

Its very simple just use the DOM

function submitPartialData () {
<formname> is the name of your form.

Call this function whenever you feel the user has completed filling the partial data.

Assumption 2:
You do not wish to repaint the entire screen again in the browser i.e. you only want to send the partial data and then allow him to enter the rest of the data after the partial data is processed at the server.

Solution a:
If your server is IIS and you are using ASP, then you can use XMLRPC/XMLHTTP technique for sending the data.

Soultion b:
"Solution a" will work only in IIS (thanks to Bll.........). For other servers you can use an applet to make a RPC connection with the server and send the data to the server through that connection. you can use XML to send/recieve the data. On the server you can use a servlet/jsp to process that data.

The above two solutions i.e. Solution a and Soultion b avoid repainting of the sceen in the browser.

Note for solution "b" to work with XML you need an XML parser. Sun provides one.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact