Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

These two functions setError() and setWarning() can have a number of different returns. In addition to the type of message set, the return will also determine behavior. The following table explains the expected results of using either function and the return values. In the table, "not-false" means any return that is not Boolean false. False-ish values (0, empty string, etc.) do not count.

Function
Return
Result
setError()
false

Error is issued, Save or Delete fails

setError()
not-false

Warning issued, save or delete passes

setWarning()
false

Error is issued, save or deletefails

Note: An additional generic Error line will display because a false return implies an error message should have been set and was not.

  Generic Message text: "A Validation Error has occurred"

setWarning()
not-false

Warning issued, save or delete passes.

setError() + setWarning()
false

Error issued with both messages, save or delete fails.

setError() + setWarning()
not-false

Warning issued with both messages, save or delete passes.

...