Hi Leo,
Do you mean that you just want to prevent submission when only the boolean field equals no?
e.g:
step 1(entity A) -> Step 2(entity B) -> step 3(entity A)
now the boolean field is on step 2 form, you will be always prevented to step 3 if the field equals no,
but actually you want to prevent all of 3 forms submission when the field equals no?
If so, I'm not sure whether it could be achieved due to each form/page has its own submit button, and custom javascript only runs for corresponding form.
My thought is that you could create a localStorage object(it'll save in user's browser cache) which is used to mark the boolean field status,
in step/form that has the boolean field
if (window.jQuery) {
(function($) {
if (typeof(webFormClientValidate) != 'undefined') {
var originalValidationFunction = webFormClientValidate;
if (originalValidationFunction && typeof(originalValidationFunction) == "function") {
webFormClientValidate = function() {
originalValidationFunction.apply(this, arguments);
if ($('#new_acceptance_0').prop('checked') === true &&
$('#new_acceptance_1').prop('checked') === false) {
localStorage.setItem('acceptance', 'false');
return true;
}
};
}
}
}(window.jQuery));
}
in your final step, prevent submission by checking the variable value
if (window.jQuery) {
(function($) {
if (typeof(webFormClientValidate) != 'undefined') {
var originalValidationFunction = webFormClientValidate;
if (originalValidationFunction && typeof(originalValidationFunction) == "function") {
webFormClientValidate = function() {
originalValidationFunction.apply(this, arguments);
var acceptance = localStorage.getItem('acceptance');
cnosole.log(acceptance);
if (acceptance === false) {
return false;
}
};
}
}
}(window.jQuery));
}
However, you might need to create multiple such objects to save data which were added previously to make fields could still be populated.
But the method still can't prevent form which has the boolean field be submitted.
In a word, that's web form design at present, you might need to wait whether new feature which is mentioned by LA could be available in April update.
Regards,
Clofly