Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 16th, 2005, 04:02 PM
Authorized User
 
Join Date: Nov 2005
Location: , , .
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to x_ray
Default Multiple forms one submit

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 With Quote
  #2 (permalink)  
Old December 28th, 2005, 04:50 AM
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to lameneural
Default

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 With Quote
  #3 (permalink)  
Old December 28th, 2005, 02:28 PM
Authorized User
 
Join Date: Nov 2005
Location: , , .
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to x_ray
Default

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 With Quote
  #4 (permalink)  
Old December 28th, 2005, 08:35 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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 With Quote
  #5 (permalink)  
Old December 29th, 2005, 03:51 AM
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to lameneural
Default

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 With Quote
  #6 (permalink)  
Old January 2nd, 2006, 06:17 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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 With Quote
  #7 (permalink)  
Old January 3rd, 2006, 12:48 AM
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to lameneural
Default

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 With Quote
  #8 (permalink)  
Old January 3rd, 2006, 07:12 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cant submit forms rashmid PHP How-To 3 May 29th, 2005 04:34 PM
cant submit forms rashmid HTML Code Clinic 1 May 24th, 2005 05:33 AM
document.forms[0].submit()-not function?? junemo JSP Basics 0 April 27th, 2004 12:40 AM



All times are GMT -4. The time now is 04:45 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.