Friday, October 23, 2009

[add-on] customizable severity feature and the continue with warnings add-on

the next version of extval will offer violation severities for constraints via extval-validation parameters as well as via jsr303 payload parameters. that means it's possible to define the severity for every constraint.

sometimes it is needed that you can save the form-data and continue in the application even though there are still warnings. so version x.x.3 (for jsf 1.x and jsf 2.x) of extval will allow that you can change the behavior (depending on the severity) via a custom add-on.

that means:
the user tries to submit invalid data. there are just warnings and no errors. so the page gets refreshed and the warnings are displayed. so far we have the expected jsf behavior. if the user clicks again on the (same) button the add-on recognizes that the user already saw the warnings and if there are no errors the warnings are ignored this time. the usage is quite simple:

the required steps:

add extval to the project
add the add-on to the project

use the constraints
from extval:


or from jsr 303


and within the form you just have to add the following hidden field:


that's it!

if you would like to have a button which is still strict and doesn't continue with warnings, you can use a special parameter. since the implementation of the add-on is quite simple it's also possible do implement it the other way round.

optional for the strict behavior:


the add-on is available at: http://code.google.com/p/os890/source/browse/#svn/trunk/java/web/jsf/extval/continue_with_warnings and requires the current trunk version of extval (or the next milestone v.1.2.3M2)