Form Validation with Dataset Not Working Properly

When I set up form validation using a dataset connected submit button, the subsequent form validation doesn’t work properly. I am able to click through my form without being prevented by form validation.

Note that if I edit any field on the form in any way, the validation will then work.

The issue can be seen in the video below.

The form in question contains a single dataset and 8 input fields, including 5 text boxes, one radio button group and 2 check boxes. Each input field is connected to a dataset field and there is one button on the page connected to the dataset submit functionality.

When I first come to the page, all my required fields are red (note, this is undesirable since I would prefer they not go red until the submit button is clicked, but I can live with it). If I click the submit button without editing any fields, I am NOT prevented from going to the next page.

If I am in the same scenario described above and edit any field on the form (even one that isn’t required), if I then click the submit button I am prevented from going to the next page and given the appropriate validation failure message.

Have I set something up incorrectly?

I’ve discovered a hack to work around this, and while it isn’t my favorite, it has resolved the issue for now:

$w.onReady(function () {
    $w('#camperRegistrationDataset').onReady(() => {
        var guardianName = $w('#guardianName').value;
        $w('#camperRegistration2019Dataset').setFieldValue('guardianName', guardianName);

By setting a field to its own existing value, the validation is able to recognize that it has failed.

Any Input Field that you have setup in that fields settings as required will be red when you open it. That color of red is a UI Design thing and you can change that in the design of the field under ERROR settings.

But when you set a field as required it will require the user to enter the type of text / value that correspond to the field. Maybe you have copied fields on your page and some field still has type = number or phone number but it is a text field in the data collection and therefore you will get an error.

Double check all fields.

In the video it seems that you go from page to page with different information and if you don’t SAVE between pages and hit the Backward button in the browser the storage won’t work for the entered data.

I would suggest you add your form elements into a slider instead and just use next and previous in the slider to navigate between the different information areas. Then you are on the same page and can use the same dataset on all forms.