Hi,
I looked in the archive and cant find an answer to this. I am trying to limit
an html:text box to numerical keypresses only ,using Javascript if there is
no better solution. I dont want to reload the page after every keypress.

I haven't used JavaScript or in fact struts much but I have this code.

<script language="JavaScript">
<!--
  // Times can only have numerical entries.
  function checkNumericalKey() {
    if ( event.keyCode < 48 || event.keyCode > 57 ) {
      alert( "Only numbers are allowed in this field!" );
      return false;
    } else {
      return true;
    }
  }
  document.
-->
</script>

called by this.

<html:text size="5" maxlength="5" property="monFromAM" tabindex="15"
onkeypress="checkNumericalKey();"/>

unfortunately it doesn't seem to even call the function. Any idea what I am
doing wrong.

Thanks in advance.
Simon Meaden

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to