Validation of hidden section in Sitecore Forms causes inconsistent behavior


Description

In Sitecore Forms 9.1.0 - 9.3.0, when sections are hidden or shown depending on certain conditions, the validation of fields in hidden sections might fail. For example, the form cannot be submitted, or, in the case of multi-page forms, the validation of fields can fail after returning to the previous page.

Solution

To resolve this issue, apply the following workaround:

  1. Open the \sitecore\modules\Web\ExperienceForms\scripts\form.conditions.js file.
  2. Replace the following line:
     $target.slideDown();
    with

    // Start of Sitecore.Support.341616 
    // $target.slideDown();
    var $self = this;
    $target.slideDown(function () {
    $self.setRequired($target);
    });
    return;
    // End of Sitecore.Support.341616

  3. Replace the following line:
     $target.slideUp();
    with

    // Start of Sitecore.Support.341616
    // $target.slideUp();
    var $self = this;
    $target.slideUp(function () {
    $self.setRequired($target);
    });
    return;
    // End of Sitecore.Support.341616

  4. Clear the browser's cache.