Validate almost one of two textbox

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
 
R

Raghupathi K

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;
}
 
R

Raghupathi K

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;
}
 
L

Luigi

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top