开发者

How to get all the pages validated, not just the current one, when submitting a form?

开发者 https://www.devze.com 2023-04-06 21:14 出处:网络
First I created a form in Orbeon Forms with Form Builder. Next I made it a multi-page form as described in Create a wizard or multi-page form with Form Builder.

First I created a form in Orbeon Forms with Form Builder. Next I made it a multi-page form as described in Create a wizard or multi-page form with Form Builder.

The problem I'm facing is that when subm开发者_如何转开发itting the form, validation only occurs on the currently visible sections. When submitting, I would like all sections to be validated even though only one section may be visible. What would be the best way to achieve this?


I would recommend you change the code of your "Next" button so it doesn't switch to the following page if there are errors on the current page. You can do so by adding an if "guard" on the <xforms:setvalue> inside the "Next" button, that reads:

if="xxforms:instance('fr-error-summary-instance')/valid = 'true'"

This will also make things easier for users: if you let them navigate to page 2 while there are errors on page 1, when they try to save while on page 2, you will somehow have to tell them that the error is on a previous page, and provide a way for them to navigate to that page.

0

精彩评论

暂无评论...
验证码 换一张
取 消