Versions Compared

Key

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

...

Sets a validation error message. Error message messages must be addressed by the User before a record is allowed to be altered. Error messages will have a red header bar. If this function is called multiple times, only the message from the last calls is displayed.

...

Sets the validation warning message. Warning messages can be used for informational purposes and can be ignored by the User to allow altering a record after viewing the message. Warning message will have a yellow header bar. If this function is called multiple times, only the message from the last calls is displayed.

...

These two functions setError() and setWarning() can have a number of different returns. In additional 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.

Function
Return
Result
setError()
falseThe 

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

 issued with both messages, save or delete passes.

What this means is that the return dictates whether the action passes (false: no, not-false: yes)and what dialog type Users get (false: error, not-false: warning). Messages just correspond to the type of return sent.


For all of the following examples, a Custom Validation was written to require a Reference on all Services.

...