You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "cocoon.erard" <co...@besonet.ch> on 2006/05/23 12:59:01 UTC

Hello, 

I'm playing a bit with the <fd:java />-Tag for widget validation. My form is binded with a Java Bean and I' try to access from my custom WidgetValidator the other fields of the binding class. Is this possible to get the JavaBean somehow in the WidgetValidator or do I have to deal with the widgets and their values?

I know, it is possible to instanciate the Validator while runtime and set it after to the widget, but I'd like it more the other way.

thanks, 

Mike 


____________________________________________
QuickLine WebMail - http://www.QuickLine.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re:

Posted by Simone Gianni <s....@thebug.it>.
Hi Mike,
unfortunately binding is performed before (load) and after (save) form
execution, and no relationship between the backend binded bean (or XML)
is kept during form execution.

You can use a couple of techniques, none of them is tidy but they work :
- Add a field to the form, with datatype bean and state invisible, and
either use a binding "." or set it from the flow with
form.lookupwidget('.....').setValue(bean). You can then access to the
bean with a lookupWidget('....').getValue().
- Add the bean as an attribute of the form, from the flow, with
form.setAttribute('bean', bean); The you can access it from everywhere
with widget.getForm().getAttribute('bean');

The second one is the simplest one.

A standard way to access the backend bean/xml from the form data model
has been considered on the dev mailing list a few times, if you have any
idea feel free to :
- Post your idea on dev, motivating why you need it and how you think it
should/could be implemented.
- Try to patch the cocoon form code to implement it, and post a patch on
Jira.

Hope this helps,
Simone

cocoon.erard wrote:

>Hello, 
>
>I'm playing a bit with the <fd:java />-Tag for widget validation. My form is binded with a Java Bean and I' try to access from my custom WidgetValidator the other fields of the binding class. Is this possible to get the JavaBean somehow in the WidgetValidator or do I have to deal with the widgets and their values?
>
>I know, it is possible to instanciate the Validator while runtime and set it after to the widget, but I'd like it more the other way.
>
>thanks, 
>
>Mike 
>
>
>____________________________________________
>QuickLine WebMail - http://www.QuickLine.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>  
>
-- 
Simone Gianni

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org