473,694 Members | 2,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

multiple forms in one asp page?

Hi everyone,
my colleagues are thinking about have three insurance plans on one asp page:

I simplify the plan as follow:

text box:number of people
plan1 plan2 plan3
dropdown menu1: dropdown menu2: dropdown menu3:
for people choose for people choose for people choose
different coverage different coverage different coverage
limit limit limit

.... ... ...

text box11: price1 text box22: price2 text box33: price3
buy button1 buy button2 buy button3
What they want is: 1)if dropdown menu1 is changed then the price1 will be
automatically updated,
if data in menu2/menu3 is changed, then price2/price3 will be
automatically updated...
if number of people to be insured is changed, all three prices will be
update automatically
The only thing I can think of is using javascript, which I don't like use
that much as I just found
out a while ago that in Mac_PC OS 9 with IE installed on it, javascript
doesn't work at all(firebox with mac_pc OS9 is OK).
is there any better way to implement this client side dynamic function?
Is there any easy way to identify which buy button is clicked in the
following asp page, so I know which data set
I need to pass to the next asp page?
should I put the three plans in one form or multiple forms, I never
programed multiple forms in one asp
page. Any expert opinions or suggestions?

--
Betty
Oct 25 '06 #1
5 14122
Hello Betty,

As for the page's logic you mentioned, IMO, client-side scripting is the
reasonable solution to do it. As you said that you've met the problem with
script on MAC OS, do you mean the script function incorrectly or script
can not run totally?

Based on my experience, for some certain browser model, there does exists
some difference and compatiblility issue between different browsers. If
what you care about is the script difference between multiple browsers,
there exists some article introducing client browser detecting and execute
script according to browser type:
http://www.quirksmode.org/js/detect.html

http://www.webreference.com/js/column6/
for your another question:

=============
should I put the three plans in one form or multiple forms, I never
programed multiple forms in one asp
==============

I think this depend on your data on the form and how you'll process them.

1. When using multiple forms, we can assign separate page to process the
data of each form when the user submit each form respectively. So this can
help separate different code logic into different ASP processing pages.

2. When we post a web page, the data in html form(which is submitted) will
be carried in the http request. Therefore, if you put all the three forms's
elements into one form, everytime you submit the form, all the form
element's data (no matter useful or not) will be carried in httprequest.
This will impact performance when there is large amount of data.
However, if you use multiple forms, each time one form is submited, the
data input in other forms will not be carried in the httprequest, this can
imrpove network transfer performance when the input data is large.

BTW, if you put all the elements in one single form, you can surely
identify which button(1 or 2 or 3) cause the submit at server-side, you can
just at some client-script to mark an <input type="hidden" /element at
client-side before form submit and check this field at server-side code.
Actually, this is what ASP.NET page do ,you can also adopt this appraoch in
classic ASP page.

Please feel free to let me know if you have anything unclear or any other
information you wonder.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 25 '06 #2

Hi Steven,
Thank you for the reply. You are right, in some way, javascript is a good
solution. but MAC OS 9.0 with IE 5.x, Javascript just doesn't work on it at
all(totally, not incorrectly). But MAC OS 10 with IE, javascript works fine.
I am just not a javascript person and It takes too much effort for testing.
The resouce you provided is good, I will refer it later on.
About multiple forms, You are absolutely write, and I will just pass one of
the forms data when one of the buttons is clicked.
I did use Javascript to identify which button is clicked in one of my old
programs.
Acutally, when one of the buttons is clicked, I reset the form values and
then the values are checked on the server-side to determine which button is
clicked.
But I don't know what you mean by <input type="hidden"/>, can you specify a
little more.
Here is mine version:
in the form I have :
<tr>
<td class="alternat e"</td>
<td class="quote"<i nput type="submit" name="CFARPlus" value="Buy
Now" onClick="return CheckInput(this .form, 'Y', 'Y')"</td>
<td class="options" <input type="submit" name="CFAR" value="Buy Now"
onClick="return CheckInput(this .form,'Y', 'N')"></td>
<td class="options" <input type="submit" name="NOCFARPlu s" value="Buy
Now" onClick="return CheckInput(this .form, 'N', 'Y')"></td>
<td class="options" <input type="submit" name="NOCFAR" value="Buy
Now" onClick="return CheckInput(this .form, 'N', 'N')"></td>
</tr>
<script language="javas cript">
<!--
function CheckInput(form , CFARFlag, PlusFlag) {
if (CFARFlag=='Y' )
form.Plan.value ='CFAR';
else
form.Plan.value ='No';

if (PlusFlag=='Y')
form.SelectPlus .value='Yes';
else
form.SelectPlus .value='No';
//alert(form.Plan .value);
//alert(form.Sele ctPlus.value);
return true;

}

//-->
</script>
--
Betty
"Steven Cheng[MSFT]" wrote:
Hello Betty,

As for the page's logic you mentioned, IMO, client-side scripting is the
reasonable solution to do it. As you said that you've met the problem with
script on MAC OS, do you mean the script function incorrectly or script
can not run totally?

Based on my experience, for some certain browser model, there does exists
some difference and compatiblility issue between different browsers. If
what you care about is the script difference between multiple browsers,
there exists some article introducing client browser detecting and execute
script according to browser type:
http://www.quirksmode.org/js/detect.html

http://www.webreference.com/js/column6/
for your another question:

=============
should I put the three plans in one form or multiple forms, I never
programed multiple forms in one asp
==============

I think this depend on your data on the form and how you'll process them.

1. When using multiple forms, we can assign separate page to process the
data of each form when the user submit each form respectively. So this can
help separate different code logic into different ASP processing pages.

2. When we post a web page, the data in html form(which is submitted) will
be carried in the http request. Therefore, if you put all the three forms's
elements into one form, everytime you submit the form, all the form
element's data (no matter useful or not) will be carried in httprequest.
This will impact performance when there is large amount of data.
However, if you use multiple forms, each time one form is submited, the
data input in other forms will not be carried in the httprequest, this can
imrpove network transfer performance when the input data is large.

BTW, if you put all the elements in one single form, you can surely
identify which button(1 or 2 or 3) cause the submit at server-side, you can
just at some client-script to mark an <input type="hidden" /element at
client-side before form submit and check this field at server-side code.
Actually, this is what ASP.NET page do ,you can also adopt this appraoch in
classic ASP page.

Please feel free to let me know if you have anything unclear or any other
information you wonder.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 2 '06 #3
Hello Betty,

Glad to hear from you.

Yes, I've mentioned using the html hidden field(<input type="hidden" .../>
) to help detect which form is submit. The detailed steps and logic is as
below:
** in each of the html <formsection, you add a <input type="hidden"
.../element, and this element's value is assigned the corresponding
form's id or name
** When in the handler page(to which all the forms submit to), you can use
code to check the html hidden field e.g.
<% Response.Write( "<br/>formid: " & Request.Form("f ormid")) %>
Thus, you can detect which form is submit. Here are two sample page(one
contains multi forms, another is the handle page which process the form's
submit data...), you can have a look for reference:

===========mult i-form page=========== ======
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitl ed Page</title>
</head>
<body>
<br /><br />form1<br />
<form id="form1" name="form1" action="process .asp" method="post">
<input type="hidden" name="formid" value="form1" />
<input type="text" name="username" />
<input type="password" name="password" />
<input type="submit" value="submit" />
</form>

<br /><br />form2<br />
<form id="form2" name="form2" action="process .asp" method="post">
<input type="hidden" name="formid" value="form2" />
<input type="text" name="username" />
<input type="password" name="password" />
<input type="submit" value="submit" />
</form>

<br /><br />form3<br />
<form id="form3" name="form3" action="process .asp" method="post">
<input type="hidden" name="formid" value="form3"/>
<input type="text" name="username" />
<input type="password" name="password" />
<input type="submit" value="submit" />
</form>
</body>
</html>
=============== =============

===========proc ess.asp======== ==========
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitl ed Page</title>
</head>
<body>
<% Response.Write( "<br/>formid: " & Request.Form("f ormid")) %>
</body>
</html>
=============== ==========

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.
Nov 3 '06 #4
Steven,
Thank you so much for your detailed reply. I got what you mean. I hope you
will not be tired of my dunderhead question.
--
Betty
"Steven Cheng[MSFT]" wrote:
Hello Betty,

Glad to hear from you.

Yes, I've mentioned using the html hidden field(<input type="hidden" .../>
) to help detect which form is submit. The detailed steps and logic is as
below:
** in each of the html <formsection, you add a <input type="hidden"
.../element, and this element's value is assigned the corresponding
form's id or name
** When in the handler page(to which all the forms submit to), you can use
code to check the html hidden field e.g.
<% Response.Write( "<br/>formid: " & Request.Form("f ormid")) %>
Thus, you can detect which form is submit. Here are two sample page(one
contains multi forms, another is the handle page which process the form's
submit data...), you can have a look for reference:

===========mult i-form page=========== ======
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitl ed Page</title>
</head>
<body>
<br /><br />form1<br />
<form id="form1" name="form1" action="process .asp" method="post">
<input type="hidden" name="formid" value="form1" />
<input type="text" name="username" />
<input type="password" name="password" />
<input type="submit" value="submit" />
</form>

<br /><br />form2<br />
<form id="form2" name="form2" action="process .asp" method="post">
<input type="hidden" name="formid" value="form2" />
<input type="text" name="username" />
<input type="password" name="password" />
<input type="submit" value="submit" />
</form>

<br /><br />form3<br />
<form id="form3" name="form3" action="process .asp" method="post">
<input type="hidden" name="formid" value="form3"/>
<input type="text" name="username" />
<input type="password" name="password" />
<input type="submit" value="submit" />
</form>
</body>
</html>
=============== =============

===========proc ess.asp======== ==========
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitl ed Page</title>
</head>
<body>
<% Response.Write( "<br/>formid: " & Request.Form("f ormid")) %>
</body>
</html>
=============== ==========

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.
Nov 8 '06 #5
Thanks for your followup Betty,

You are always welcome :)

Have a nice day!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 8 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4981
by: Chris Beach | last post by:
Hi, I have a JSP page with several forms on it. Some of these forms are generated dynamically, and each of them submits some information to a database. Handling one form is easy, as I can simply make the form post to itself, and handle the data using a single bean. Since I have multiple forms, I now have a problem. Several of the forms on the page handle the same type of data
2
1317
by: clintonG | last post by:
I understand ASP.NET 1.1 will only support a single server-side form in an ..aspx page. Could I get tricky from that same page and have a second server-side form in an .aspx page displayed within an iFrame? Can you give me your favorite URL pointing to a document describing how to work with multiple forms work-arounds? -- <%= Clinton Gallagher NET csgallagher AT metromilwaukee.com
8
579
by: TJS | last post by:
what are folks doing to get around limitation of one server form per page ?
6
1912
by: Davids | last post by:
this was impossible to implement on old ASP, is it the same for .Net?
2
1345
by: sshen | last post by:
i am wondering whether this is now available in asp.net 2.0? i couldn't get any comfirmation from this newsgroup reading. thanks. 1. multiple forms (all with onserver tag) in one page 2. postback to other pages. it said that postbackURL() is now provided for this 3. array of checkbox, etc using the same id - this is very useful for datagrid (w3c feature) i struggled with above in asp.net 1.1 and wondering the changes in 2.0
7
2732
by: Jeff | last post by:
I plan to write a Windows Forms MDI application for a medical office. Users must be able to select a patient and view related information on multiple forms; with1-4 forms opened at the same time for the same patient; each form showing a different type of patient-related information. After viewing information for one patient (say on 3 forms opened simultaneously), users want the ability to select another patient. Upon selection of another...
3
4092
by: Yehia A.Salam | last post by:
hello, I have to deal with the weird limitation of asp.net, as I need to have multiple forms on my page, well three at least actually, one for the login, one for the search engine, and another one for a certain bulletin list, however asp.net allows only one form per page with runat="server" attribute, I am aware of the visibility issue and that I can hide all of the forms except one but this won't help cause I need all of the three forms...
2
2444
by: =?Utf-8?B?VGFtbXkgTmVqYWRpYW4=?= | last post by:
Hi, I am going to write a large application using Visual Studio C#. I am going to use only one Form as main menu and go to other pages by cliking on next button in each page. I dont want to create several forms and move from one form to next. However I need to have same action using only one form. Could someone show me how I can use only one form instead of multiple forms. Thanks -- Nejadian
0
8616
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9107
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8812
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7647
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5825
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4567
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2992
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2248
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.