I need help with the javascript below please. I have 2 text boxes and 1 button on my form. What I would like to happen is if User enters a value in textbox one and not textbox two, then event need not be fired. However, if there is a value in textbox one and then textbox 2 then I want a post back to fire. My code below does not seem to be doing this at all and I would appreciate it if someone could help me fix this or better still figure it out. Thanks in advance
function Changed(textControl) {
// alert(textControl.value);
var conlength = document.getElementById('<%=txtLength.ClientID %>');
var conwidth = document.getElementById('<%=txtwidth.ClientID %>');
if (conlength != null && conwidth != null) {
if (conlength.value != null && conlength.value != ' ' && conwidth.value != null && conwidth.value != ' ') {
// ' ' corresponds to c#'s String.Empty
__doPostBack(document.getElementById('<%=btncalcboardfeet.ClientID %>'), 'Calculate Board Feet Button event has been fired');
}
}
}
instead of that last if statement just try the following: