I'd suggest reading up on programming logic...
From what I've seen, you've got the javascript idea from me, and populating
the IsValid from somewhere else... The IsValid bit is not readible, even
though it makes the function shorter...
Personally I'd do this.
function ValidateSurnameCompanyEntered(sender, args)
{
var SurnameLength = document.WebForm2.txtSurname.text.length;
var CompanyLength = document.WebForm2.txtCompanyName.text.length;
if ( SurnameLength > 0 && CompanyLength == 0 )
{
args.IsValid = true;
}
if ( SurnameLength == 0 && CompanyLength > 0 )
{
args.IsValid = true;
}
// if both or neither then we get here...
args.IsValid = false;
}
"Stephen" <St*****@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
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));
}