• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

submitting multiple forms

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I have a question about submitting multiple forms by looping through each form and calling the submit function. However, when I do this, I noticed that some forms are lost, so the data cannot be submitted. Is there a way to check to see if the form before it is finished, so then it can continue with the next form? Thanks.
[ July 09, 2007: Message edited by: Bear Bibeault ]
 
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you are trying to do is not supported by the browsers. You can submit only one form at a time. This generates a request whose response is returned to the browser for display. If you submit three requests, how is the browser supposed to display three responses?

What are you really trying to accomplish with the submittal of multiple forms? There are probably supported techniques to accomplish your goal.
[ July 09, 2007: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, for future posts, please be sure to take the time to compose descriptive subjects for your posts; read this for more information.

I have adjusted the subject of this post for you.
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can't help but think that submitting multiple forms on a single page would be any more useful than just having everything submitted in one single form. Are you asking if there is a way to check if the form data has been successfully submitted before it submits the next form? I suppose that you could have a javascript function submit one form, make a request to the server to see if the data got there, verify that it is the same data, then submit the next form, but that seems to me to be a very inefficient. I could see submitting one form and verifying the data, but only in the instance where it is mission critical that the data makes it through.

Could you elaborate a bit more on what you are trying to do? I feel like I am missing part of the picture, or just naive about how that would be useful.

EDIT: Bear, I just saw your post, and for the sake of argument, what would prevent me from doing as I described above? (Not that it would be at all practical)
[ July 09, 2007: Message edited by: Chad Clites ]
 
Edison Trow
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The reason why I'm doing this is because I'm using struts to generate multiple forms. Once the user looks at all the forms and make the decision by checking an option for each form, the user will click on one button called update that will commit all the forms. I have already tried using one form but it is impossible in struts, because I do not know how many forms will be generated beforehand. Thanks again. Sorry Bear, now I know.
 
Bear Bibeault
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Chad Clites:
EDIT: Bear, I just saw your post, and for the sake of argument, what would prevent me from doing as I described above? (Not that it would be at all practical) ]



Your example assumes that you will be able to run script on the page after submission. Not so. Once the request is submitted, the page is unloaded and replaced with the response of the request.

P.S. This all changes, of course, if Ajax is employed.
[ July 09, 2007: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Edison Trow:
I have already tried using one form but it is impossible in struts, because I do not know how many forms will be generated beforehand.



That sounds rather specious to me. While it's been may moons since I gave up on Struts, as I recall you specify the forms using tags on the pages. Therefore you are in control of how many forms are generated.
 
reply
    Bookmark Topic Watch Topic
  • New Topic