By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,156 Members | 1,071 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,156 IT Pros & Developers. It's quick & easy.

2 buttons in ASPX page

P: n/a
Tom
Hi,

I have a aspx form with 2 submit buttons.

For the first button, it submits 2 text box data and no need to do
javascript validation.

For the second button, it submits 5 text box data and has to do javascript
validation to check email, phone, etc.

The form tag has onsubmit="javascript:return CheckInput();"

Since it is not possible to include 2 form tags in one aspx form, the js
validation performs checking when I input data and press the first button.
However, js validation is done only when the 2nd button is pressed.

So, how can I fix that problem or I have to use 2 separate forms?

Thanks
Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Can't you use a button instead of a submit in the case one that needs to
validate, then have an onlcick="CheckInputAndSubmit"

then in your CheckInputAndSubmit function have a form1.submit(); at the
end of the function if the form is valid.

<Form ID="Form1" runat="server">
<Input type="Button" onclick="CheckInputAndSubmit">
</Form>
<script .... . >
CheckInputAndSubmit()
{
...
......

Form1.submit();
}
</script>

Tom wrote:
Hi,

I have a aspx form with 2 submit buttons.

For the first button, it submits 2 text box data and no need to do
javascript validation.

For the second button, it submits 5 text box data and has to do javascript
validation to check email, phone, etc.

The form tag has onsubmit="javascript:return CheckInput();"

Since it is not possible to include 2 form tags in one aspx form, the js
validation performs checking when I input data and press the first button.
However, js validation is done only when the 2nd button is pressed.

So, how can I fix that problem or I have to use 2 separate forms?

Thanks

Nov 19 '05 #2

P: n/a
It doesn't sound like you are using the ASP.NET Validation web controls. If
you did, this would be easy.
Add the necessary validators, using the CustomValidator to handle cases you
cannot.
Set the button's CausesValidation property to false when it should not
validate.

If you investigated the ASP.NET Validation web controls and found it lacking
something, "Professional Validation And More"
(http://www.peterblum.com/vam/home.aspx) is a replacement that addresses
most of the issues with Microsoft's validators including client-side
validation on many more browsers than just IE and IE/Mac.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Tom" <To*@discussions.microsoft.com> wrote in message
news:F2**********************************@microsof t.com...
Hi,

I have a aspx form with 2 submit buttons.

For the first button, it submits 2 text box data and no need to do
javascript validation.

For the second button, it submits 5 text box data and has to do javascript
validation to check email, phone, etc.

The form tag has onsubmit="javascript:return CheckInput();"

Since it is not possible to include 2 form tags in one aspx form, the js
validation performs checking when I input data and press the first button.
However, js validation is done only when the 2nd button is pressed.

So, how can I fix that problem or I have to use 2 separate forms?

Thanks

Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.