What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Password protected form is still printing even with the wrong code

    Asked by hamoye on October 10, 2016 at 10:16 AM

    Hello,

     

    BDAVID helped me earlier with how not to print a particular field on a form that is password protected and this is working well.

     

    I have a print/submit button on my form:

    https://form.jotform.co/62826443873868

     

    When I enter an INCORRECT number, the form still Prints/submits a blank form how do I prevent this from happening please.

     

    Thanks,

    Page URL:
    https://form.jotform.co/62826443873868

    protected password protected JotForm print
  • Profile Image
    JotForm Support

    Answered by Boris on October 10, 2016 at 10:27 AM

    I have checked your form, and when entering an incorrect number, neither the Submit nor Print buttons are shown:

    I'm unable to submit your form, unless I enter the correct authorization code. Can you please let us know an example wrong number that you enter when you are able to submit the form?

    From what I'm seeing so far, your form seems to be functioning as designed. We look forward to your response with any more details you can provide, so we can try replicating the issue and assist you accordingly. Thank you.

  • Profile Image

    Answered by hamoye on October 10, 2016 at 12:45 PM
    Hi Boris,
    I don't think it's working right-
    trying entering something like:
    !8888 (this is a wrong number) and press enter
    here is what you'll get:
    [image: Inline image 1]
    - you'll notice the form on the right is blank right?
    And when I click on "cancel", I see this:
    [image: Inline image 2]
    The correct number for the form is: !6734- but you don't even need this in
    order to recreate the errors above.
    Thanks a lot!
    ...
  • Profile Image
    JotForm Support

    Answered by Jan on October 10, 2016 at 02:38 PM

    I was able to replicate the issue you're describing. When you press enter, the form automatically print and submits. This is caused by the current "Print & Submit Form" button in your form.

    I tried inserting a required field and a Captcha inside the Form Collapse but the issue persist. The solution here is to remove the current button and use the standard "Submit" button and "Print Form" button.

     

    Hope that helps. Thank you.

  • Profile Image

    Answered by hamoye on October 10, 2016 at 09:02 PM

    Hello- 

    The solution is not very convenient.

    There has to be another way so that the form does not show or print if the code is invalid despite pressing enter.

  • Profile Image

    Answered by hamoye on October 10, 2016 at 10:02 PM

    Is there a way to create a pop-up or page that would say "incorrect code" if a wrong code is inserted and "entered"- in place of the the submit/print function from working automatically? This would be a better workaround if possible. 

    Thanks,

  • Profile Image
    JotForm Support

    Answered by Jim_R on October 11, 2016 at 03:12 AM

    Thanks for the additional info. I'm afraid what we're trying to override here is a default behavior of any form (regardless if it's built in Jotform or not). This is something referred to as Implicit Submission as described on HTML5 specifications. Pressing the Enter key submits any form by default.

    This is important to accessibility and impaired users that cannot use a mouse at all. There are pages on the Web that are only usable if there is a way to implicitly submit forms, so user agents (browsers) are strongly encouraged to support this.

    If you really want to suppress this default behavior of forms, the only way around it with JotForm is to get your form's entire source code and use Javascript to prevent the Enter key from submitting the form. Or do it the way you described, show a popup that will say incorrect code.

    I found a really good read about this topic on this post in case you're interested to know why it was designed that way. At the latter part of that post will be alternatives on suppressing it (especially the Explicit Prevention part where they gave an example JS code snippet to prevent it).

    Other than that, the only other workaround is to use our Default Submit button as suggested by Jan, as it completely disables submitting the form on Enter if the button is hidden.

  • Profile Image

    Answered by hamoye on October 11, 2016 at 08:45 AM
    Hi- I hope you can help further though.
    So, I found my source code, and see below, so how can I do either of the 2
    things you mentioned:
    1) "use javascript" to prevent enter key from working- how do I do this?
    or
    2) How do I get the popup to work?
    Can you assist?
    type="text/javascript"> type="text/javascript"> type="text/css" /> type="text/css" media="print" rel="stylesheet" target="_blank" href="
    https://cdn.jotfor.ms/css/printForm.css?3.3.15190" /> rel="stylesheet" target="_blank" href="
    https://cdn.jotfor.ms/themes/CSS/54be8d1c700cc4d5368b4567.css?"/> type="text/css"> .form-label-left{ width:150px !important; } .form-line{
    padding-top:10px; padding-bottom:10px; } .form-label-right{ width:150px
    !important; } .form-all{ width:651px; color:#555 !important;
    font-family:'Arial'; font-size:16px; } .form-radio-item label,
    .form-checkbox-item label, .form-grading-label, .form-header{ color: #555;
    } type="text/css" rel="stylesheet" target="_blank" href="
    https://cdn.jotfor.ms/css/responsive.css?3.3.15190" /> class="jotform-form" action="
    https://submit.jotform.co/submit/62826443873868/" method="post"
    name="form_62826443873868" id="62826443873868" accept-charset="utf-8">
    class="form-all"> class="form-line jf-required" data-type="control_textbox" id="id_129">
    for="input_129"> Authorization code *
    type="text" class=" form-textbox validate[required]"
    data-type="input-textbox" id="input_129" name="q129_authorizationCode"
    size="20" value="" />
    id="section_127" style="display:none;"> class="form-input-wide" data-type="control_collapse">
    class="form-collapse-table form-collapse-hidden" id="collapse_127"> class="form-collapse-mid" id="collapse-text_127"> Show form class="form-collapse-right form-collapse-right-show">   ...
  • Profile Image
    JotForm Support

    Answered by seth on October 11, 2016 at 09:39 AM

    If you insist on using Print&Submission button instead of default Submit button, you need to download source code, edit it and publish your final HTML code as your form (i.e. embedding into a web site or saving to your web site as a html document)

    Here are the steps:

    1) open a notepad or sublime text editor to manipulate source code

    2) download source code, please use the button on the screen to copy the code and paste it to your notepad.

    3) copy this code and paste it at the end of your document.

    <script type="text/javascript">

        document.getElementById('input_129').addEventListener('keypress', function(event) {

            if (event.keyCode == 13) {

                event.preventDefault();

            }

        });

    </script>

    Then save this text document as (example.html). Then preview and test on your browser. 

    If you have other issues please ask here.

    Cheers.

     

     

     

     

     

  • Profile Image

    Answered by hamoye on October 11, 2016 at 10:45 AM
    Hello- Sorry, if my question is amateur - if I added this new code you
    provided to the jotform source code, it won't work?
    I really want to keep it on jotform- so will the pop-up to circumvent print
    ...
  • Profile Image
    JotForm Support

    Answered by seth on October 11, 2016 at 10:57 AM

    If you insists on using Print&Submit button instead of default Submit button, you have to insert javascript code to source every time you updated form before publishing.

    In other words other approach could be differentiating print and submit buttons. Otherwise there is no chance to work on only JustForm UI.

    Good Luck!

     

  • Profile Image

    Answered by hamoye on October 11, 2016 at 11:45 AM
    Thanks- I agree- that will be cumbersome to have to always update it.
    I have a Thank You page that comes up when the form is submitted. Is there
    a way to add a Print button on this Thank you Page? If you can please help
    with the steps that will be most helpful.
    ...
  • Profile Image
    JotForm Support

    Answered by Boris on October 11, 2016 at 11:47 AM

    There may be a third alternative, other than using the modified source code or individual Submit and Print buttons. That is to use a field that actually accepts the ENTER key in its input - so when your users hit the ENTER key, the form is not submitted.

    An example of this would be by using a Text Area field instead of a Text Box field for collecting the "Authorization code":

    Since a Text Area moves its input onto a new line when hitting the ENTER key instead of submitting the form, the field itself may not look as neat as a Text Box field, but this is the only other alternative to avoid using source code, or individual Submit and Print buttons. I hope this helps.

  • Profile Image

    Answered by hamoye on October 11, 2016 at 12:45 PM
    Thank you- this is a very good alternative and it works.
    ...
  • Profile Image
    JotForm Support

    Answered by seth on October 11, 2016 at 03:17 PM

    Thanks to Boris' clever mind, I am happy that you solved your issue that easy. It is my fault that I tried this strategy but could not achive the result. If you encounter any other thing please contact us.

    Cheers.