Validating required fields before moving to the next page of the form

  • Profile Image
    graeme.bell
    Asked on April 10, 2017 at 10:00 AM

    Hi Support,

     

    In the function "input.validate" (jotform.forms.js?3.3.18300) - called after the next button is pressed, JotForm.isVisible is called - skip validation if not.

     

    However, the layout appears to have been recalculated before this point. Thus the new page is already visible; and in our forms all required fields have already been checked and marked as 'form-validation-error'.

     

     

    (Likewise, navigating to the page with the tabs, and then using the next button will not validate the current page).

     

    Please could you investigate?

     

    Thanks,

     

    Graeme

  • Profile Image
    Welvin
    Answered on April 10, 2017 at 11:48 AM

    The Form Tabs widget has the option to allow skipping required fields in each page. You may consider disabling that option if you wish to require users to complete the page before moving to the next page.

     

    Please let us know if you require additional assistance.

  • Profile Image
    graeme.bell
    Answered on April 11, 2017 at 06:17 AM

    If i disable the tab option (which I don't want to do), then there is a problem with display of the actual tab (not the content). The wrong tab is SOMETIMES highlighted.

    It seems that as a javascript include (which generates an iframe), the event which changes the variable "JotForm.currentSection" occurs after the event which handles the 'current tab'.

     

     

    In jotform.form.js?3.3.18309:

                    JotForm.currentSection = JotForm.nextPage.show();

     

    In scripts.min.js, updateCurrentTab:

                    this.currentPage = this.currentSection.pagesIndex - 1

     

     

    These are the result of two different event handlers, and the order that they are called changes between 'include mode' and viewing the form directly on jotform.com.

  • Profile Image
    Welvin
    Answered on April 11, 2017 at 08:36 AM

    I'm sorry, but I need to clarify what you want to do with the page break and Form Tabs widget. Are you suggesting to change this behavior? Would you mind letting us know how you'd like these things to work? 

    If you select "No" in the widget settings, then all required fields are validated, and you cannot proceed to the next page unless you fill these fields. As far I understand, that's how you want it. Please clarify.