Workflow : How to make a field required only for the accept button and not the reject one?
Hi,
On Nuxeo 5.6, using Studio, about forms in accept/reject tasks : I would like through the workflow designer to make a field required, but only for the “accept” button and not for the “reject” one.
I tried something by setting the required field to false and by using conditions on transitions in a way that I “manually” check the value of a given NodeVariable, if it is empty and the user pressed “validate”, the user is redirected to the same task. But this lead to a user-confusing experience I'm trying to avoid.
The nice way would be to work at the jsf form validation level so the user is not redirected to an other page. Is it possible through studio? Is it even possible outside studio?
Thanks
Murkein, i unmarked this as a valid solution, as it's not the same issue: the "immediate" boolean on actions does have the same meaning than immediate attribute on JSF command tags, here's a good explanation of how it works http://balusc.blogspot.fr/2006/09/debug-jsf-lifecycle.html#AddImmediateTrueToUICommandOnly
If the need here is to make the field required only depending on which button is clicked, setting the action as immediate will not help (especially, submitted values will be ignored, required or not)
You can try adding the following expression for the custom property “required” on the widget definition:
#{request.getParameter('button') == 'accept'}
Here 'accept' is the name of the button defined on the workflow.
I have try this solution to test if a widget value is mandatory compare to an other widget value in the same workflow form task. like,
{ layoutValue.get('var') != null && layoutValue.get('var') != "" }
this need to click on the "next button" and come back with "previous button" of second form to see its mandatory setting up :-(