Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > How to validate one of two Required TextBox

Reply
Thread Tools

How to validate one of two Required TextBox

 
 
Gilles Lambert
Guest
Posts: n/a
 
      04-14-2005
Hi,

I've to require a value in either of two TextBox. I tried with the
CustomValidator with the function :

function MobTel(source, args) {
if ( Form1.txtTelephone.value == "" && Form1.txtMobile.value == "" ) {
args.IsValid = false;
return;
}
}
args.IsValid = true;
return;
}

But the function is not called at all despite the fact it is affected to
the Property ClientValidationFunction of the control to validate.

Should i implement the server validation or is it a way to proceed this
kind of validation ?

Thanks and best regards
Gilles


*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      04-14-2005
What browser are you using? The client side validation only is supposed if
the browser is IE. You should always implement a server validation function
for this reason.

-Brock
DevelopMentor
http://staff.develop.com/ballen



> Hi,
>
> I've to require a value in either of two TextBox. I tried with the
> CustomValidator with the function :
>
> function MobTel(source, args) {
> if ( Form1.txtTelephone.value == "" && Form1.txtMobile.value == "" )
> {
> args.IsValid = false;
> return;
> }
> }
> args.IsValid = true;
> return;
> }
> But the function is not called at all despite the fact it is affected
> to the Property ClientValidationFunction of the control to validate.
>
> Should i implement the server validation or is it a way to proceed
> this kind of validation ?
>
> Thanks and best regards
> Gilles
> *** Sent via Developersdex http://www.developersdex.com ***
>




 
Reply With Quote
 
 
 
 
Gilles Lambert
Guest
Posts: n/a
 
      04-14-2005
I'm using IE6, with client scripts enabled. Ok for the server
validation, but i don't understand why the function is not called ?



*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Validate almost one of two textbox Luigi ASP .Net 3 11-27-2009 11:38 AM
Use one field to validate values in one of two fields Meredith Javascript 1 02-11-2005 02:05 PM
How to have One RequiredFieldValidator to Validate Two TextBox Nicolas ASP .Net 0 12-03-2003 02:43 PM
writing two textbox's text in one textbox agb ASP .Net Web Controls 1 08-27-2003 12:57 AM



Advertisments