premzero
11-10-2003, 05:23 PM
I'm having funny problems with the trim function.
Here's my code.
<FORM METHOD="post" ACTION="somefile.htm" name="topForm" onsubmit="checkChoice();return false;">
<INPUT TYPE="TEXT" NAME="keywords" SIZE="20" MAXLENGTH="50" VALUE="">
<INPUT TYPE="button" VALUE="Search" onclick="checkChoice();">
</form>
The header script handling the form.
function checkChoice(){
if (trim(document.all.keywords.value) == ""){
alert('Please enter a search query.');
}
else {
document.all.topForm.submit();
return true;
}
}
It gives an error right when I click search and points to
the line with the search button where it's calling the
JS function (on click).
I remove trim.. it works like a charm.
Please help.
Here's my code.
<FORM METHOD="post" ACTION="somefile.htm" name="topForm" onsubmit="checkChoice();return false;">
<INPUT TYPE="TEXT" NAME="keywords" SIZE="20" MAXLENGTH="50" VALUE="">
<INPUT TYPE="button" VALUE="Search" onclick="checkChoice();">
</form>
The header script handling the form.
function checkChoice(){
if (trim(document.all.keywords.value) == ""){
alert('Please enter a search query.');
}
else {
document.all.topForm.submit();
return true;
}
}
It gives an error right when I click search and points to
the line with the search button where it's calling the
JS function (on click).
I remove trim.. it works like a charm.
Please help.