Skip to content

Custom error parameters

zhaber edited this page Aug 2, 2012 · 2 revisions

In addition to an error message one can define custom error parameters that will be passed to a client side. For example, to change the input element next to which the error has to be shown an element parameter can be used:

pswdConfirm eq(pswd) [e("Passwords do not match", element: "pswd")]

Here e is a method that takes an error message as the first argument, a map of custom parameters as the second, and constructs a validation exception that will be thrown in case of unsuccessful validation. If an error message is not needed the first parameter can be skipped:

pswdConfirm eq(pswd) [e(element: "pswd")]