phillystyle123
asked on
re: multiple variables in simple form validation script
I've got 2 text fields -
1. attorney_name
2. attorney_phoneNumber
i need both to be filled out if my radio button:
attorney_representation - Yes
is checked.
i have a working script for 1 of the fields (attorney_name) but i need to add the other (attorney_phoneNumber)
1. attorney_name
2. attorney_phoneNumber
i need both to be filled out if my radio button:
attorney_representation - Yes
is checked.
i have a working script for 1 of the fields (attorney_name) but i need to add the other (attorney_phoneNumber)
function getRadialValue(strFieldName){
var objFormField = document.forms[0].elements[strFieldName]
intControlLength = objFormField.length
for (i=0;i<intControlLength;i++){
if(objFormField[i].checked){
strValue = objFormField[i].value;
return strValue;
}
}
}
function validate(theForm){
if(getRadialValue('attorney_representation')=='Yes'){
if(theForm.attorney_name.value==''){
alert('Please enter Attorney Name');
return false;
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks so much - i've been working on this way too long today - much appreciated