• Resolved inorman

    (@inorman)


    I’m having an issue on a calculator I made with Calculated Fields Form. I’m using a simple Number Field to take user input. If the user presses “Enter” when typing in the field, it causes the page to refresh and any user input is reset to the default value. The Number Field input is later use for one Calculated Field.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @inorman

    Please, insert a “HTML Content” field in the form, and enter as its content, the following piece of code:

    
    <script>
    jQuery(document).on("keypress", 'form', function (e) {
        var code = e.keyCode || e.which;
        if (code == 13) {
            e.preventDefault();
            return false;
        }
    });
    </script>
    

    Note: you are using a plugin for caching the website, please, purge the cache.

    Best regards.

    Thread Starter inorman

    (@inorman)

    @codepeople Thanks for your quick support. That worked perfectly to prevent the issue. Why is it necessary that I need to use this HTML code and what do I need to know to avoid this issue in the future? When is it necessary to use this code in the future?

    Plugin Author codepeople

    (@codepeople)

    Hello @inorman

    In the HTML standard, if you press the enter into an input tag, the form is submitted. The plugin includes a code to prevent this behavior, so, I guess there is active another plugin on your website that restores it again.

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pressing Enter in a Number Field causes page refresh, resets to default value.’ is closed to new replies.