Validating two textbox controls

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Im trying to do a function to validation two textbox controls. I want the
user to enter in text to either txtSurname or txtCompanyName but not both. Is
my logic wrong and if so can someone help me change this to achieve my goal.
Im really terrible at this and am under pressure to get it done so any help
at all would be appreciated.

function ValidateSurnameCompanyEntered(sender, args)
{
var txtSName = document.WebForm2.txtSurname;
var txtCompName = document.WebForm2.txtCompanyName;
args.IsValid = ((txtSName.text.length>0 && !(txtCompName.text.length < 0))
|| txtSName.text.length> 0 && (txtCompName.text.length < 0));
}
 
Stephen,

The only thing you have to know is if the textbox lenghts are both longer
than 0 than it is an error in your case.

However probably you will as well not that they both are equal to 0.

This is a general newsgroup, when it is a code question, than the newsgroup
microsoft.public.dotnet.languages.csharp is probably a better place.

I hope this helps?.

Cor
 
Back
Top