[jboss-user] [JBoss jBPM] - Re: Bypass Form Validation For Certain Operations?

khamburg do-not-reply at jboss.com
Fri Aug 3 19:53:10 EDT 2007


I also don't see the point of requiring a value but allowing it to be an empty string. The point of requiring a value is so that you obtain the required user input. In addition, sometimes you need to verify that the non-empty value meets additional validation requirements (such as being a valid date).

As you pointed out, specifying the validation in the PDL is preferable to performing validation in the UI. I would recommend that the jpdl schema be enhanced to support more validation. 

As a work-around, I have written an action handler that validates based on "rules" read from the tag content. It is not very sophisticated, but it supports my current needs. I can add the action handler to a node-leave event which enforces validation on all transitions, or I can add the handler to just a single transition event so that other transitions do not require validated input. When a validation error occurs, an exception is thrown which results in a message being displayed to the user in the jbpm console.

Here's an example of it's use:

  |   <task-node name="GetData">
  |     <task name="GetDataTask">
  |     <transition to="NextTask" name="Accept Data">
  |           <action class="mypackage.AssertRequiredVariables">
  |             <assertions>
  |               <entry><key>MyDate</key><value>date</value></entry>
  |               <entry><key>MyString</key><value>string not-empty</value></entry>
  |             </assertions>
  |           </action>
  |       </transition>
  |     <transition to="AlternateStep" name="Date Not Required"></transition>
  |   </task-node>
  | 
In this case, the data is only required on the Accept Data transition. This allows canceling or going to a step that doesn't require the input without forcing the user to enter data that passes the normal validation.



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070823#4070823

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070823



More information about the jboss-user mailing list