PDA

View Full Version : onBindAndValidate in PR5



boriskin
Jul 26th, 2005, 12:37 PM
Is onBindAndValidate no longer called by FormAction?
I see doValidate method instead that is calling custom defined validateMethod, but is it only expecting a defined validator class or can I reuse action form subclass like i did with onBindAndValidate?

boriskin
Jul 26th, 2005, 04:07 PM
Callback onBind is removed as well. This is all from the latest in CVS. Is there a reason for this?

tortuga
Jul 26th, 2005, 05:13 PM
See http://forum.springframework.org/showthread.php?t=16556 post for details on why they were removed, especially the 7th comment down on that post from Keith Donald.

Keith Donald
Jul 26th, 2005, 05:28 PM
We've removed them in favor of action method chaining, a capabability easily possible with webflow.

What value was onBindAndValidate and onBind providing to you? Do you have a problem with action chaining from your flow definition as follows:



<action-state id="state">
<action name="binder" bean="formAction" method="bindAndValidate"/>
<action bean="formAction" method="afterBindAndValidate"/>
<transition on="success" to="otherState"/>
</action-state>

boriskin
Jul 26th, 2005, 07:16 PM
I have a situation where using validators the standard way is too complex, that is why i am relying on onBindAndValidate, which gives me a convenient way to run custom validation logic and have request scope and bindexception objects at hand. If i use action chaining i would have to call getFormErrors() every time.

Also, if i use action chaining, i cannot simply return error() from the next action in chain and expect the flow to return to the previous view, because it will look for an error view instead unlike onBindAndValidate which returns control to bindAndValidate and goes back to the calling view if error() is returned. I would have to have extra configuration to be able to return somethign like result("back"), which would be the same for every view i have. Maybe there is something like this in the framework already?