i have the following line in my html file

Code:
<form name="theform" action="<? echo(WS_HTTP_SERVER . '/search') ?>" method="post" onsubmit="return checkKeywords(document.theform.keywords.value)" style="display: inline; margin: 0px;">
everything works ok if i actually click submit button however if i press the enter key on the keyboard, i get an error that document.theform.keywords.value is null even if it is not. can anyone tell me how i can get the form to work with both the submit button and the enter key?