Hi,
I currently use the following to force a user to input data in a textbox
this is called from a submit image
but now i want to give users a choice of either a phone number or email or address...or a combination
the other text boxes will be called x_email and x_address
can you help me do this
I currently use the following to force a user to input data in a textbox
Code:
function EW_hasValue(obj, obj_type) {
if (obj_type == "TEXT" || obj_type == "PASSWORD" || obj_type == "TEXTAREA" || obj_type == "FILE") {
if (obj.value.length == 0)
return false;
else
return true;
} else if (obj_type == "SELECT") {
if (obj.type != "select-multiple" && obj.selectedIndex == 0)
return false;
else if (obj.type == "select-multiple" && obj.selectedIndex == -1)
return false;
else
return true;
} else if (obj_type == "RADIO" || obj_type == "CHECKBOX") {
if (obj[0]) {
for (i=0; i < obj.length; i++) {
if (obj[i].checked)
return true;
}
} else {
return (obj.checked);
}
return false;
}
}
function EW_onError(form_object, input_object, object_type, error_message) {
alert(error_message);
if (object_type == "RADIO" || object_type == "CHECKBOX") {
if (input_object[0])
input_object[0].focus();
else
input_object.focus();
} else if (!EW_isHTMLArea(input_object, object_type)) {
input_object.focus();
}
if (object_type == "TEXT" || object_type == "PASSWORD" || object_type == "TEXTAREA" || object_type == "FILE") {
if (!EW_isHTMLArea(input_object, object_type))
input_object.select();
}
return false;
}
function EW_checkMyFormcontactus(EW_this) {
if (EW_this.x_phone && !EW_hasValue(EW_this.x_phone, "TEXT" )) {
if (!EW_onError(EW_this, EW_this.x_phone, "TEXT", "Please enter a phone number..."))
return false;
}
return true;
}
this is called from a submit image
Code:
<input name="Action" type="image" id="Action" value="ADD" src="images/messagebutbot_06.gif" width="44" height="18" border="0" alt="send" onClick="return EW_checkMyFormcontactus(this.form);">
but now i want to give users a choice of either a phone number or email or address...or a combination
the other text boxes will be called x_email and x_address
can you help me do this