cancel
Showing results for 
Search instead for 
Did you mean: 

Server side form validation for user tasks

danielbehrwind
Champ in-the-making
Champ in-the-making
Hi,

I'm planning to use Activiti in a web application (using Grails) and was wondering if there is any way to specify constraints for a user task's form properties other than "required" (e. g. min and max values for an integer, max size for a string…).

What I want is: The user enters some data, the server validates the data against the constraints (maybe some kind of meta data?) and only submitts the data if validation passes.

Thanks for any hints!

Cheers
Daniel
2 REPLIES 2

jbarrez
Star Contributor
Star Contributor
No, that's not in there (yet). It's something which I would like to see there, but no date has been given to it.

danielbehrwind
Champ in-the-making
Champ in-the-making
Thanks for your reply.

I figured that this was not (yet) possible, thus devised a workaround using the Grails constraints mechanisms. In case anybody runs into the same problem:

I defined a script task as first task of my process that sets a map of form property IDs to associated constraints, like this

constraints = [
someLongFormProperty: [min: 1L],
someStringFormProperty: [
  inList: ['red', 'green', 'yellow']
]
]

In my application I then use a Grails command object, bind the entered form values to it, set the constraints defined in the process variable and validate the command object. This way I can leverage the power of Grails validations and still define the constraints as part of the process definition. Only thing that did not work was using custom Grails validators since they are defined as Closures which are not Serializable and thus cannot be stored as process variables.