Validate almost one of two textbox

  • Thread starter Thread starter Luigi
  • Start date Start date
L

Luigi

Hi,
how can I validate a group of 2 textbox so the users have to populate at
least one of them (or both)?

Thanks in advance.

Luis
 
Hi,
how can I validate a group of 2 textbox so the users have to populate at
least one of them (or both)?

Thanks in advance.

Luis

Use Javascript Function

function jsValidateTextBoxGroup(sTxtBox1, sTxtBox2)
{
var bSuccess = true;
var sTxtBox1Value = document.getElementById(sTxtBox1).value;
var sTxtBox2Value = document.getElementById(sTxtBox2).value;

if (sTxtBox1Value == "" && sTxtBox2Value == "")
{
alert("Either of text boxes " + sTxtBox1 + " & " + sTxtBox2 + "
must be entered");
bSuccess = false;
}
return bSuccess;
}
 
function jsValidateTextBoxGroup(sTxtBox1, sTxtBox2)
{
var bSuccess = true;
var sTxtBox1Value = document.getElementById(sTxtBox1).value;
var sTxtBox2Value = document.getElementById(sTxtBox2).value;

if (sTxtBox1Value == "" && sTxtBox2Value == "")
{
alert("Either of text boxes " + sTxtBox1 + " & " + sTxtBox2 + "
must be entered");
bSuccess = false;
}
return bSuccess;
}
 
Raghupathi K said:
function jsValidateTextBoxGroup(sTxtBox1, sTxtBox2)
{
var bSuccess = true;
var sTxtBox1Value = document.getElementById(sTxtBox1).value;
var sTxtBox2Value = document.getElementById(sTxtBox2).value;

if (sTxtBox1Value == "" && sTxtBox2Value == "")
{
alert("Either of text boxes " + sTxtBox1 + " & " + sTxtBox2 + "
must be entered");
bSuccess = false;
}
return bSuccess;
}

Thank you Raghupathi.

L
 
Back
Top