469,603 Members | 2,285 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,603 developers. It's quick & easy.

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 13556
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Chris Beach | last post: by
2 posts views Thread by clintonG | last post: by
8 posts views Thread by TJS | last post: by
6 posts views Thread by Davids | last post: by
2 posts views Thread by sshen | last post: by
3 posts views Thread by Yehia A.Salam | last post: by
2 posts views Thread by =?Utf-8?B?VGFtbXkgTmVqYWRpYW4=?= | last post: by
reply views Thread by guiromero | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.