tags:

views:

625

answers:

3

I have a table where each row will represent a form. There could be over 25 rows in the table.

I need to post the rows that have a checkbox checked and get the results and display success of fail. I am posting to a site that I do not have any control over and they take one rows worth of data.

I tried this using IFrames and it seemed to work ok but not in IE7 without browser config changes which is not possible in my case.

I have figured out enough to get all the forms to submit but then how do I get the results.

A: 

The user could post the form to your own site (you could even use AJAX for this), then use a server-to-server XMLHTTP request to communicate with the server(s). This way you eliminate all the client-end clumsiness.

If you do it with Ajax asynchronously you won't have to have the client wait for all the multiple forms to post and report back.

Diodeus
Are you suggesting, to have one large form for the whole table and then have that submit to my other page which handles each post and updates the first form?
Brian G
Yes. Post it using Ajax, do the rest on the server, and receive the response code in the same Ajax call.
Diodeus
+1  A: 

I definitely would recommend doing it with AJAX. Download prototypejs and call e.g. the Ajax.Updater. There you pass your parameters and wait asynchronously for the response. You can chuck the response into seperate container or into one.

new Ajax.Updater('response_container', 'http://yoururl', {
  parameters: { param1: $F('someformfield') },
  method: 'post'
});
Michal
A: 

You could use the javascript prototype library to process, concatenate and submit the forms as a single form. I wouldn't recommend this with 25 forms though, especially not if you're using the same field names in each form.

Anyway, here's a recipe: http://tech.solin.eu/doku.php?id=webdev:submitting_multiple_forms_at_once

Onno