3 Replies - 5252 Views - Last Post: 28 July 2007 - 01:45 PM Rate Topic: ***-- 2 Votes

#1 fyrestorm  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 10
  • View blog
  • Posts: 3,113
  • Joined: 04-April 02

form validation with .NET 1.1

Post icon  Posted 06 June 2007 - 07:03 AM

I'm using the form validators that microsoft made available for us to use in .NET and I'm having a small problem with them.

I've got multiple forms on a page and multiple submit buttons. If I click submit on the form that doesn't contain the validators, the form with the validators is still activated. I.E. The form I'm not using gets validated.

Is there a way around this, something I'm missing perhaps?

Thanks :)

Is This A Good Question/Topic? 0
  • +

Replies To: form validation with .NET 1.1

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1642
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: form validation with .NET 1.1

Posted 28 July 2007 - 01:41 PM

View Postfyrestorm, on 6 Jun, 2007 - 06:03 AM, said:

I'm using the form validators that microsoft made available for us to use in .NET and I'm having a small problem with them.

I've got multiple forms on a page and multiple submit buttons. If I click submit on the form that doesn't contain the validators, the form with the validators is still activated. I.E. The form I'm not using gets validated.

Is there a way around this, something I'm missing perhaps?

Thanks :)


Are you saying you have multiple <form> tags on your page? If so you're only allowed to have a single <form> tag per page, this is one of the, in my opinion, drawbacks to ASP.Net.

As for the validation controls, ASP.Net web controls have a ValidationGroup Property so use that to tie those controls to a specific validation control/submit button.

Like say for example you have 2 "forms" on a page, one where the user can send you an email, the other where the user can submit a question, both have textboxes and such and both have a submit button. Use ASP: controls and set the ValidationGroup to "EMail" for the section where they can send an email (for all the controls for that process, even the ASP:Button) , then set the ValidationGroup Property to "Question" for the other section (once again all controls, even the ASP:Button control).

This will keep the 2 processes seperate and allow for multiple submit buttons for multiple processes on one page with a single <form> tag.

Hope this at least gets you down the path you're looking for :)

<edit> I;ve added a zip file with an aspx page that shows what I'm talking about with the ValidationGroup</edit>

Attached File(s)


This post has been edited by PsychoCoder: 28 July 2007 - 01:44 PM

Was This Post Helpful? 0
  • +
  • -

#3 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1877
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: form validation with .NET 1.1

Posted 28 July 2007 - 01:42 PM

Is that specific to ASP.NET? I've never seen the <form> tag limit in other languages...
Was This Post Helpful? 0
  • +
  • -

#4 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1642
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: form validation with .NET 1.1

Posted 28 July 2007 - 01:45 PM

View Postskyhawk133, on 28 Jul, 2007 - 12:42 PM, said:

Is that specific to ASP.NET? I've never seen the <form> tag limit in other languages...


Yeah, it's specific to ASP.Net. In classic ASP you could have 100 <form> tags on a page if you wanted but not anymore. I believe thats why they added the ValidationGroup Property to .Net Web Controls.

Heres a link that talks about it

This post has been edited by PsychoCoder: 28 July 2007 - 01:48 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1