Hi all, I am trying to validate weather or not a text box contains any text or not. I am pretty certain my javascript works, except I don't think my javascript is able to see my input field. Any ideas why it can't read it? My other js works. //Javascript function CharCount() { valid = true; if (document.uspworkphn4.value == "" ) { valid = false; } else { alert('The Extension field is meant for non-Direct Dial branches only. \n If you have a Direct Dial (10-digit) number that rings directy \nto your phone, please leave the extension number blank.'); } } //HTML <input type="input" id="uspworkphn4" name="uspworkphn4" onblur="CharCount();" OnKeypress="return isNumberKey(event)" value="#uspworkphn4#" size="5" maxlength="10" /> Edit/Delete Message
you need to use the form name in the arguement: if (document._FORM_NAME_uspworkphn4.value == "" ) Code (markup):
if you really want to get longivity out of this... if (document.getElementByID("uspworkphn4").getAttribute("value").length == 0)