473,414 Members | 1,684 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

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 14089
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="alternate"</td>
<td class="quote"<input 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="NOCFARPlus" 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="javascript">
<!--
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.SelectPlus.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("formid")) %>
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:

===========multi-form page=================
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled 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>
============================

===========process.asp==================
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
</head>
<body>
<% Response.Write("<br/>formid: " & Request.Form("formid")) %>
</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("formid")) %>
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:

===========multi-form page=================
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled 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>
============================

===========process.asp==================
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
</head>
<body>
<% Response.Write("<br/>formid: " & Request.Form("formid")) %>
</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
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...
2
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...
8
by: TJS | last post by:
what are folks doing to get around limitation of one server form per page ?
6
by: Davids | last post by:
this was impossible to implement on old ASP, is it the same for .Net?
2
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....
7
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...
3
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...
2
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...

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.