Validation of a "form" made up from multiple web blocks

I've got a scenario similar to the one described here:
https://www.outsystems.com/forums/discussion/48070/passing-data-from-multiple-web-blocks-on-a-single-page/

In my case, I haven't 100% decided on using web blocks on the page, but the reason it's appealing is because there's a lot of complex logic about what input fields show up when. For example, if the user selects option "A" from a given drop down in section 1, then sections 2 - 5 & 10 show up, whereas if they select option "B" instead, sections 2, 3 & 7 show up, and then if they select option "A" from a drop down in section 2, then sections 11 - 13 show up, that sort of thing. Conceptually, it'd be nice to create web blocks for each field section, and web blocks for each of the options, so that the logic would be simplified to "if the user selects option 'A' from section 1, show web block 'A.'"

However, if I were to use this approach, I'm not sure how I could do "form" validation, IE blocking submits when required fields have not been set, or doing any other custom validation I need to do. Any thoughts?

Thanks!

Kirk

Hey Kirk,

I'd say the required fields and custom validations can either be done inside the web blocks (if they can be made generic to a certain type of web block/field/section), but if they are specific to your screen, you will need to do it on the form submit.

Validation becomes trickier when using Web Blocks and/or reusable validation rules... most approaches to this that I've seen tend to use the Event System I mention in the post you refer to.

Solution

Jorge Martins wrote:

Hey Kirk,

I'd say the required fields and custom validations can either be done inside the web blocks (if they can be made generic to a certain type of web block/field/section), but if they are specific to your screen, you will need to do it on the form submit.

Validation becomes trickier when using Web Blocks and/or reusable validation rules... most approaches to this that I've seen tend to use the Event System I mention in the post you refer to.


A idea on how Jorge Martins concept using the OutSystems Events might be executed.

Solution