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.

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    Thank you Mike for this idea (I was testing such a one),

    but how (where) do you set this var local!SectionAHasValidationError ?

    In the SaveInto of each field?  (I have more than 30 fields)

    Can't we do that once?

    (I've tried to do it in the "validations" section, but how?  as "a!save" is forbidden)

  • 0
    Certified Lead Developer
    in reply to cedric01

    You would set that and similar local variables in the top-level variable declaration of your form.  As I already mentioned, the variable will re-evaluate automatically when any of the other data it uses is changed (assuming you're using a!localVariables() under default settings).

Reply Children