R
Robert Nurse
Hi All,
I've got a form which I'm trying to submit automatically when the user
has entered 2 or more characters in a text imput box. Here's my set
up:
<SCRIPT language="JavaScript1.2">
function submitLetters(form, control)
{
var returnValue = true;
if (event.keyCode == 13)
returnValue = false;
else
{
if (CheckFilter(form) == true)
form.submit();
else
returnValue = false;
}
return returnValue;
}
function CheckFilter(form)
{
var returnValue = true;
if (form.nTypeFilter.value.length < 2)
returnValue = false;
return returnValue;
}
</SCRIPT>
<FORM name="displayByLastName" method="post" onSubmit="return
CheckFilter(this);">
<INPUT type="text" name="nTypeFilter" value="" onKeyPress="return
submitLetters(displayByLastName, this);">
</FORM>
I'm finding that nothing is getting into form.nTypeFilter.value until
submitLetters() returns true. How can I manually force the key
pressed into the form field's value from my onKeyPress handler? Also,
how do I get the actual event key character rather than just its
numerical value?
I've got a form which I'm trying to submit automatically when the user
has entered 2 or more characters in a text imput box. Here's my set
up:
<SCRIPT language="JavaScript1.2">
function submitLetters(form, control)
{
var returnValue = true;
if (event.keyCode == 13)
returnValue = false;
else
{
if (CheckFilter(form) == true)
form.submit();
else
returnValue = false;
}
return returnValue;
}
function CheckFilter(form)
{
var returnValue = true;
if (form.nTypeFilter.value.length < 2)
returnValue = false;
return returnValue;
}
</SCRIPT>
<FORM name="displayByLastName" method="post" onSubmit="return
CheckFilter(this);">
<INPUT type="text" name="nTypeFilter" value="" onKeyPress="return
submitLetters(displayByLastName, this);">
</FORM>
I'm finding that nothing is getting into form.nTypeFilter.value until
submitLetters() returns true. How can I manually force the key
pressed into the form field's value from my onKeyPress handler? Also,
how do I get the actual event key character rather than just its
numerical value?