468,170 Members | 1,857 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Help with validator

Hi,

I have a page with one <form></form>.

This page contains 2 part forms with 2 buttons, one for each part form.

<form>

Part 1
<date>
<requiredfiledvalidator>
<button1 OnClick="btn1_OnClick" >

Part 2
<name>
<address>
<button2 OnClick="btn2_OnClick">

</form>

Part 1 of the form has a required field with a date that must be field in
before clicking button1.

Problem is when I click button2 required field validator from form part 1
fires up.

How can I disable required field validator from form part 1 when I click on
button2.

Thanks
Nov 18 '05 #1
8 1080
There is no great solution for this situation until ASP.NET 2.0 comes out
next year.
The current built-in validator controls don't support this functionality.
You'll have to build your own custom validator functionality I suspect.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"News" <ge**@lycos.com> wrote in message
news:eJ********************@magma.ca...
Hi,

I have a page with one <form></form>.

This page contains 2 part forms with 2 buttons, one for each part form.

<form>

Part 1
<date>
<requiredfiledvalidator>
<button1 OnClick="btn1_OnClick" >

Part 2
<name>
<address>
<button2 OnClick="btn2_OnClick">

</form>

Part 1 of the form has a required field with a date that must be field in
before clicking button1.

Problem is when I click button2 required field validator from form part 1
fires up.

How can I disable required field validator from form part 1 when I click on button2.

Thanks

Nov 18 '05 #2
I tried CustomValidator, problem is that it fires up only if text box is
populated with some content and does not work as required field validator
(what I need it for, to make sure that date is filled in).
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:ey**************@TK2MSFTNGP10.phx.gbl...
There is no great solution for this situation until ASP.NET 2.0 comes out
next year.
The current built-in validator controls don't support this functionality.
You'll have to build your own custom validator functionality I suspect.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"News" <ge**@lycos.com> wrote in message
news:eJ********************@magma.ca...
Hi,

I have a page with one <form></form>.

This page contains 2 part forms with 2 buttons, one for each part form.

<form>

Part 1
<date>
<requiredfiledvalidator>
<button1 OnClick="btn1_OnClick" >

Part 2
<name>
<address>
<button2 OnClick="btn2_OnClick">

</form>

Part 1 of the form has a required field with a date that must be field in before clicking button1.

Problem is when I click button2 required field validator from form part 1 fires up.

How can I disable required field validator from form part 1 when I click

on
button2.

Thanks


Nov 18 '05 #3
Hi.

It's extreamly easy to resolve this problem. Just set the Enabled property
of all validators on the page to "False". Than modify it to "True" in a
definite event handler only for validators that you want to be working. Thus
others will stay disabled.

Regards,

Vladimir

"News" <ge**@lycos.com> wrote in message
news:eJ********************@magma.ca...
Hi,

I have a page with one <form></form>.

This page contains 2 part forms with 2 buttons, one for each part form.

<form>

Part 1
<date>
<requiredfiledvalidator>
<button1 OnClick="btn1_OnClick" >

Part 2
<name>
<address>
<button2 OnClick="btn2_OnClick">

</form>

Part 1 of the form has a required field with a date that must be field in
before clicking button1.

Problem is when I click button2 required field validator from form part 1
fires up.

How can I disable required field validator from form part 1 when I click on button2.

Thanks

Nov 18 '05 #4

.... oh yes, and triger Page.Validate() method after that!
"Vladimir" <co***@ukr.net> wrote in message
news:u9**************@TK2MSFTNGP09.phx.gbl...
Hi.

It's extreamly easy to resolve this problem. Just set the Enabled property
of all validators on the page to "False". Than modify it to "True" in a
definite event handler only for validators that you want to be working. Thus others will stay disabled.

Regards,

Vladimir

"News" <ge**@lycos.com> wrote in message
news:eJ********************@magma.ca...
Hi,

I have a page with one <form></form>.

This page contains 2 part forms with 2 buttons, one for each part form.

<form>

Part 1
<date>
<requiredfiledvalidator>
<button1 OnClick="btn1_OnClick" >

Part 2
<name>
<address>
<button2 OnClick="btn2_OnClick">

</form>

Part 1 of the form has a required field with a date that must be field in before clicking button1.

Problem is when I click button2 required field validator from form part 1 fires up.

How can I disable required field validator from form part 1 when I click

on
button2.

Thanks


Nov 18 '05 #5
Tried that, in the OnClick method but but it did not work, in what method I
can set it?
blagodar'u Vladimir

"Vladimir" <co***@ukr.net> wrote in message
news:eX**************@TK2MSFTNGP12.phx.gbl...

... oh yes, and triger Page.Validate() method after that!
"Vladimir" <co***@ukr.net> wrote in message
news:u9**************@TK2MSFTNGP09.phx.gbl...
Hi.

It's extreamly easy to resolve this problem. Just set the Enabled property
of all validators on the page to "False". Than modify it to "True" in a
definite event handler only for validators that you want to be working. Thus
others will stay disabled.

Regards,

Vladimir

"News" <ge**@lycos.com> wrote in message
news:eJ********************@magma.ca...
Hi,

I have a page with one <form></form>.

This page contains 2 part forms with 2 buttons, one for each part form.
<form>

Part 1
<date>
<requiredfiledvalidator>
<button1 OnClick="btn1_OnClick" >

Part 2
<name>
<address>
<button2 OnClick="btn2_OnClick">

</form>

Part 1 of the form has a required field with a date that must be field in before clicking button1.

Problem is when I click button2 required field validator from form
part 1 fires up.

How can I disable required field validator from form part 1 when I

click on
button2.

Thanks



Nov 18 '05 #6
Look, you have to make all your validators in aspx code with
"Enabled"=False. In this case whatever button you click - no one will work.
Than in some OnClick event handler you should write

private void SomeButton_OnClick (.......)
{
.......
_MyValidator1.Enabled = true;
Page.Validate()
.....
}

Run it in debug mode and be shure that your event is handled by this method
and keep track of all steps. If your validator change it's state to enabled
and then Page revalidates itself, all must work. And it do works 100%.

Regards,

Vladimir

"News" <ge**@lycos.com> wrote in message
news:gz***************@news04.bloor.is.net.cable.r ogers.com...
Tried that, in the OnClick method but but it did not work, in what method I can set it?
blagodar'u Vladimir

"Vladimir" <co***@ukr.net> wrote in message
news:eX**************@TK2MSFTNGP12.phx.gbl...

... oh yes, and triger Page.Validate() method after that!
"Vladimir" <co***@ukr.net> wrote in message
news:u9**************@TK2MSFTNGP09.phx.gbl...
Hi.

It's extreamly easy to resolve this problem. Just set the Enabled property of all validators on the page to "False". Than modify it to "True" in a definite event handler only for validators that you want to be
working.
Thus
others will stay disabled.

Regards,

Vladimir

"News" <ge**@lycos.com> wrote in message
news:eJ********************@magma.ca...
> Hi,
>
> I have a page with one <form></form>.
>
> This page contains 2 part forms with 2 buttons, one for each part form. >
> <form>
>
> Part 1
> <date>
> <requiredfiledvalidator>
> <button1 OnClick="btn1_OnClick" >
>
> Part 2
> <name>
> <address>
> <button2 OnClick="btn2_OnClick">
>
> </form>
>
> Part 1 of the form has a required field with a date that must be
field in
> before clicking button1.
>
> Problem is when I click button2 required field validator from form

part
1
> fires up.
>
> How can I disable required field validator from form part 1 when I

click on
> button2.
>
> Thanks
>
>



Nov 18 '05 #7
I have written a simple sub that 'turns' on and off the validators, until
..NET 2.0 comes out with validation groups ... that is my current work around
....

"Vladimir" <co***@ukr.net> wrote in message
news:OH**************@TK2MSFTNGP11.phx.gbl...
Look, you have to make all your validators in aspx code with
"Enabled"=False. In this case whatever button you click - no one will work. Than in some OnClick event handler you should write

private void SomeButton_OnClick (.......)
{
......
_MyValidator1.Enabled = true;
Page.Validate()
....
}

Run it in debug mode and be shure that your event is handled by this method and keep track of all steps. If your validator change it's state to enabled and then Page revalidates itself, all must work. And it do works 100%.

Regards,

Vladimir

"News" <ge**@lycos.com> wrote in message
news:gz***************@news04.bloor.is.net.cable.r ogers.com...
Tried that, in the OnClick method but but it did not work, in what method
I
can set it?
blagodar'u Vladimir

"Vladimir" <co***@ukr.net> wrote in message
news:eX**************@TK2MSFTNGP12.phx.gbl...

... oh yes, and triger Page.Validate() method after that!
"Vladimir" <co***@ukr.net> wrote in message
news:u9**************@TK2MSFTNGP09.phx.gbl...
> Hi.
>
> It's extreamly easy to resolve this problem. Just set the Enabled property
> of all validators on the page to "False". Than modify it to "True"

in a > definite event handler only for validators that you want to be working. Thus
> others will stay disabled.
>
> Regards,
>
> Vladimir
>
> "News" <ge**@lycos.com> wrote in message
> news:eJ********************@magma.ca...
> > Hi,
> >
> > I have a page with one <form></form>.
> >
> > This page contains 2 part forms with 2 buttons, one for each part

form.
> >
> > <form>
> >
> > Part 1
> > <date>
> > <requiredfiledvalidator>
> > <button1 OnClick="btn1_OnClick" >
> >
> > Part 2
> > <name>
> > <address>
> > <button2 OnClick="btn2_OnClick">
> >
> > </form>
> >
> > Part 1 of the form has a required field with a date that must be field in
> > before clicking button1.
> >
> > Problem is when I click button2 required field validator from form

part
1
> > fires up.
> >
> > How can I disable required field validator from form part 1 when I

click
> on
> > button2.
> >
> > Thanks
> >
> >
>
>



Nov 18 '05 #8
In fact, there are several replacements to Microsoft's validators that offer
"validation groups" today. There are numerous limitations to Microsoft's
validators (like no client-side support for non-IE browsers) so many of
these replacements offer lots more features. I wrote one of them.
"Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx. Its 22 validators support validation
groups, "smart enabling" (when a validator should turn on and off based on
something else on the page), client-side support for IE, Netscape/Mozilla,
Opera 7, and Safari, and much more.

I wrote a document that helps you understand the limitations of Microsoft's
validators: http://www.peterblum.com/vam/valmain.aspx.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
"News" <ge**@lycos.com> wrote in message
news:eJ********************@magma.ca...
Hi,

I have a page with one <form></form>.

This page contains 2 part forms with 2 buttons, one for each part form.

<form>

Part 1
<date>
<requiredfiledvalidator>
<button1 OnClick="btn1_OnClick" >

Part 2
<name>
<address>
<button2 OnClick="btn2_OnClick">

</form>

Part 1 of the form has a required field with a date that must be field in
before clicking button1.

Problem is when I click button2 required field validator from form part 1
fires up.

How can I disable required field validator from form part 1 when I click on button2.

Thanks

Nov 18 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Fox | last post: by
11 posts views Thread by Duane Lambe | last post: by
5 posts views Thread by Mattyw | last post: by
2 posts views Thread by Mike Collins | last post: by
36 posts views Thread by aljamala | last post: by
3 posts views Thread by Rich Squid | last post: by
1 post views Thread by Cortney | last post: by
1 post views Thread by gcdp | last post: by
reply views Thread by kamranasdasdas | last post: by
reply views Thread by gcreed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.