Subject: Multiple forms one submit
Posted By: x_ray Post Date: 12/16/2005 3:02:43 PM
hello all,
i want to know how to gather information in asp page from multiple forms on another page. i.e. when i press a button on page,say,p1.asp containing multiple forms(2-3),i want p2.asp to gather the information from each form.
Note: i am using asp with javascript.
Best regards.

Reply By: lameneural Reply Date: 12/28/2005 3:50:30 AM
hi x_ray,

Have you tried passing values of non-submitting to the submitting form? thru hidden fields maybe?

If you find a better solution on this, please let us also be informed.

Thanks!

Reply By: x_ray Reply Date: 12/28/2005 1:28:13 PM
thanks for the idea lameneural, but i have too many entries that way and it will be diffcult to keep tracking them into the submitting form,but anyway i will try it and try to find another solution, i think we should wait for one of those asp and javascript gods to "post" by.
thanks again!

Reply By: mat41 Reply Date: 12/28/2005 7:35:57 PM
Why use multiple forms?  

Yes hidden form fields is the way I would do it.  FYI: You can pass as many hidden values as you like - IMO this is the best way to pass values from page to page thta are not being captured from a physical input field.  My order of preference is:

1..Pysical input field type
2..Hidden field
3..querystring
4..session variable (last resort)

Wind is your friend
Matt
Reply By: lameneural Reply Date: 12/29/2005 2:51:57 AM
1..Pysical input field type
2..Hidden field
3..querystring

-- these first three are quite difficult to implement though if data to be passed are scattered in different forms. can you choose which form holds most of the data? then create hidden fields on that form that will store the data on non-submitting forms, in that way, you can call a script function on the submitting form's onSubmit event that will capture all the data on other non submitting forms.

4..session variable (last resort)

-- better. but i don't know the disadvantages though.

Reply By: mat41 Reply Date: 1/2/2006 5:17:36 PM
mmmm, you failed to answer my main question:
Why use multiple forms?

;;;better. but i don't know the disadvantages though.

Ask google 'disadvantages of session variables' and it will become clear.  In short they use allot of memory and other server resources.

This part of your post:
;;;can you choose which form holds most of the data?

Tells me you may need to re think your page design and process.  Lets not go into it but there are very few instances where you need to use multiple forms.  I dont believe I ever have.  Think about placing multiple buttons (not submit but type="button") which on some event do different actions, call different JS functions (EG for different validation).  You can even set the action (destination page) on the last line of your function - just before the formName.submit();

Wind is your friend
Matt
Reply By: lameneural Reply Date: 1/2/2006 11:48:46 PM
Ey, thanks for the information Matt!
By the way, I used mutiple forms due to layers that has also forms in it. Apologies if I dont know how to do better form designs but that's what I did..lol I do only have one form though that will have the method="post" which will contain most of my hidden fields and will "post" the data to the action page via a function called on all other form 's onSubmit. I don't know if that is good, but works fine anyway..:) If you can recommend other designs that will do better in terms of process and resource consumption, please let me know.. :)

Thanks again!
newbie here.. :)

Reply By: mat41 Reply Date: 1/3/2006 6:12:14 PM
You are welcome

;;I used mutiple forms due to layers that has also forms in it
The layers are still (based on coords) on the same page and, I believe can share the same form.

;;;Apologies if I...
No need to apologize. Thats what this place is all about, people helping people...

;;;I do only have one form though
mmmm, now im not sure if you have one or multiple forms...  Any how if your page is working, great.

;;;...recommend other designs
If you are using hidden form fields this is the way I would do it.  Just remember you cant post values to a page(p1 and transaction 1), click on a link to another page(p2), submit a form back to p1 and retain the values from transaction 1 unless you use session variables or the like.  How ever you can post them from page to page, to page, to page etc.  

If there are many of these values or the data lengths are big, I would:
1..Store them in a temporary DB table
2..Get the unique ID of this record (INT)
3..Store it in a session variable
4..Now when you need these values get them based on this variable



Wind is your friend
Matt

Go to topic 38009

Return to index page 404
Return to index page 403
Return to index page 402
Return to index page 401
Return to index page 400
Return to index page 399
Return to index page 398
Return to index page 397
Return to index page 396
Return to index page 395