Validation Message keeps on showing

Hi Guys, I have a sample UI below where in a validation message shows when a button is clicked.

When Button "Complete" is clicked it validates if Field1 to 5 has value. While the "Save and Close" button only validates the Fields 4 and 5. 

In this scenario the "Complete" button is clicked which shows the validation message below since Field1 to 5 is empty. Then I put values to Field4 and Field5 and clicked "Save and Close" this time. Since I'm just clicking "Save and Close" It should proceed with submission of the form since Field4 and 5 have values. But it keeps showing a validation message when clicking "Save and Close". How can I can hide the validation message so that when I click "Save and Close" the form can be submitted.

Thanks in advance!

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Personally I'd suggest you try an approach like the following and see how it works out:

    Create a local variable (in "with()") called e.g. local!validateSaveAndCloseButton

    Set this local variable such that it is TRUE when the conditions are such that it shouldn't work (i.e. when 4 and 5 are blank or whatever).

    Then in the button for Save and Close, if it's a!buttonWidget, add "validate: local!validateSaveAndCloseButton"; that way when field 4 and 5 are filled out, the Save and Close button will submit the form regardless of whether the validation message is currently showing up, which I think satisfies your use case.

Reply
  • 0
    Certified Lead Developer

    Personally I'd suggest you try an approach like the following and see how it works out:

    Create a local variable (in "with()") called e.g. local!validateSaveAndCloseButton

    Set this local variable such that it is TRUE when the conditions are such that it shouldn't work (i.e. when 4 and 5 are blank or whatever).

    Then in the button for Save and Close, if it's a!buttonWidget, add "validate: local!validateSaveAndCloseButton"; that way when field 4 and 5 are filled out, the Save and Close button will submit the form regardless of whether the validation message is currently showing up, which I think satisfies your use case.

Children