Return to Snippet

Revision: 61747
at January 11, 2013 07:27 by lromak


Updated Code
The javascript allows only number and decimal points:

<SCRIPT language=Javascript>
       <!--
       function isNumberKey(evt)
       {
          var charCode = (evt.which) ? evt.which : event.keyCode;
          if (charCode != 46 && charCode > 31 
            && (charCode < 48 || charCode > 57))
             return false;

          return true;
       }
       //-->
    </SCRIPT>

The blank amount to pay field displays the $ until the field is active:

 <input type="num" name="charge_total" value="$" onfocus="this.value=''" onkeypress="return isNumberKey(event)" >

Revision: 61746
at January 11, 2013 07:26 by lromak


Initial Code
The javascript allows only number and decimal points:

<SCRIPT language=Javascript>
       <!--
       function isNumberKey(evt)
       {
          var charCode = (evt.which) ? evt.which : event.keyCode;
          if (charCode != 46 && charCode > 31 
            && (charCode < 48 || charCode > 57))
             return false;

          return true;
       }
       //-->
    </SCRIPT>

And the amount to pay field displays the $ until the field is active, and refers to the javascript event:

 <input type="num" name="charge_total" value="$" onfocus="this.value=''" onkeypress="return isNumberKey(event)" >

Initial URL

                                

Initial Description
Removes $ from HTML form post, allows only number and decimal points. Has $ display in field but disappear when onfocus.

Initial Title
Remove $ from HTML form on submit

Initial Tags
form, html

Initial Language
JavaScript