Form notifications are useful when you want to prevent the user saving the form if the form fields do not meet the conditions.
Say you have 2 date fields called “Start Date” and “End Date”. You want the records can only be saved if the “End Date” is bigger than the “Start Date”.
You have 2 different options to show a form notification here:
You can use setFormNotification() function when validation fails and use clearFormNotification() when validation pass. You need to specify message, level and uniqueId parameters.
Or you can use setIsValid() function. You call it only once and pass it validation result with error message. It is definitely less code lines 😎