On 01/08/2015 04:52 PM, Jason Clemons wrote:
Hello all,
I've implemented some client side page validation using JavaScript which works well,
but I want to implement some simple checks on server side also. I know how to evaluate
the values in my UI using velocity after the page is submitted, but how do I prevent the
page from saving if my criteria isn't met?
I think you can use the "Validation" feature, as explained here:
http://platform.xwiki.org/xwiki/bin/view/DevGuide/Creating+a+form+with+vali…
I see the tutorial is a bit old (still using xwiki/1.0 syntax in some places), so in case
something no longer works as documented,
another example can be found in the "MoccaCalendar" doing something similar with
its "MoccaCalendarEventValidation" script (it refuses to save events with end
time before start time)
https://github.com/xwiki-contrib/application-mocca-calendar/tree/master/app…
the latter should work, otherwise please report a bug at
http://jira.xwiki.org/browse/MOCCACAL
Cheers,
Clemens