Vermelh0
11-14-2002, 05:20 PM
I have a text input that whenever a user types stuff into it, will do a postback and will use the stuff he typed as a key to find stuff from a database.
But, whenever a user uses a key that is not valid (i.e. does not exist on the database) I use onblur to trap him in the field until he enters something valid, or clears the information. Like this:
function sendError(o)
{
if ((o.value == o.oldvalue)
{
alert(alertMsg);
o.focus();
o.select();
}
}
<input type="text" onblur="sendError(this)" value="23" oldvalue="23" onchange="doPostBack()">
My problem is that I have a cancel button that takes the user away from the page, and I want to program something that when a user presses the button the sendError function won't execute allowing the page to postback.
Right now as the page is, a user can't click the cancel button until something is valid, which is not what I want....
Any help would be appreciated,
Thank you,
V
But, whenever a user uses a key that is not valid (i.e. does not exist on the database) I use onblur to trap him in the field until he enters something valid, or clears the information. Like this:
function sendError(o)
{
if ((o.value == o.oldvalue)
{
alert(alertMsg);
o.focus();
o.select();
}
}
<input type="text" onblur="sendError(this)" value="23" oldvalue="23" onchange="doPostBack()">
My problem is that I have a cancel button that takes the user away from the page, and I want to program something that when a user presses the button the sendError function won't execute allowing the page to postback.
Right now as the page is, a user can't click the cancel button until something is valid, which is not what I want....
Any help would be appreciated,
Thank you,
V