How to validate fields on hidden section?

Certified Senior Developer

Hi,

I have a form with 2 button tabs A and B. Each one displays a section with fields (section A and Section B).

Initially, the section A is visible (section B not visible).

How may I validate the fields of the section B?

My Submit button validates only the visible fields section, so, if fields of section A are correct (and fields of Section B are not), the form is wrongly submitted.

Regards

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    It gets trickier to deal with when you need to do it this way, but after you've implemented it you'll have a lot more power/control at least.

    First, you should keep track of the validity of each section (overall) in a local variable.  i.e. local!SectionAHasValidationError (boolean), etc.  Utilizing a!localVariables() under default settings, you should simply be able to evaluate the validity of your Section A fields with normal logic in the variable definition, and it would update itself anytime any of those values is changed.

    Then, as Pedro said above, add a Form Level validation which fires at the Submit event, which itself checks which (if any) of the Section X Validation Error variables is "true", and perhaps advises the user which section has the error - they can then switch back to that section and see the particular validations on the fields themselves.

Reply
  • 0
    Certified Lead Developer

    It gets trickier to deal with when you need to do it this way, but after you've implemented it you'll have a lot more power/control at least.

    First, you should keep track of the validity of each section (overall) in a local variable.  i.e. local!SectionAHasValidationError (boolean), etc.  Utilizing a!localVariables() under default settings, you should simply be able to evaluate the validity of your Section A fields with normal logic in the variable definition, and it would update itself anytime any of those values is changed.

    Then, as Pedro said above, add a Form Level validation which fires at the Submit event, which itself checks which (if any) of the Section X Validation Error variables is "true", and perhaps advises the user which section has the error - they can then switch back to that section and see the particular validations on the fields themselves.

Children