Viewing 2 replies - 1 through 2 (of 2 total)
  • There are a couple settings on the extra fields section:

    Validation regex:
    Use to validate if form input is in a specific format. Example: If you want numbers in a text field type but do not allow text, use this regex: /^\d+$/ Can be used for text, textarea, date and password field types.

    Regex fail message:

    Use to customize a message to alert the user when the form fails to validate a regex after post. Example: Please only enter numbers. For use with validation regex only.

    It was on this page:
    https://www.fastsecurecontactform.com/how-to-add-extra-fields

    Thread Starter wp0

    (@wp0)

    First of all thank you for your answer.

    The users see the error after the submit and they can enter text in text field.

    But when i use that code the users will never enter any text in text field. Is there any way to use that code in your plugin?

    <script>
    function Number(e) {
        x1 = document.all ? window.event : e;
        key = document.all ? x1.keyCode : x1.which;
        if(key<48||key>57) {
            if(document.all) { x1.returnValue = false; } else { x1.preventDefault(); }
        }
    }
    
    function Text(e) {
        x1 = document.all ? window.event : e;
        key = document.all ? x1.keyCode : x1.which;
        if(key>=48&&key<=57) {
            if(document.all) { x1.returnValue = false; } else { x1.preventDefault(); }
        }
    }
    </script>
    <!--webbot bot="Validation" s-data-type="Integer" s-number-separators="x" --><input type="text" onKeyPress="Number(event)" name="tel" size="20">
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘onKeyPress Feature for Textbox’ is closed to new replies.