cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paloma Gomez" <paloma...@gmail.com>
Subject Re: CForms: Time widget binding problem
Date Thu, 13 Jul 2006 17:02:06 GMT
Hi Jason,

Thanks for your answer.


> You only need the converter in the binding if your target object expects
> a String representation of the widget's value, such as when you're
> binding to an XML document.  In your case you're not saving to a String
> so you don't need it.

OK, this makes things clearer :).

> You will, however, need something else to convert between the datatype
> of the widget (java.util.Date) and your bean property (java.sql.Time).
> I'm not sure if there's a better way to do it, but one approach would be
> a javascript binding:
>
> <fb:javascript id="time" path="time">
>    <fb:load-form>
>      // no conversion necessary since Time extends Date:
>      widget.setValue(jxpathPointer.getValue());
>    </fb:load-form>
>    <fb:save-form>
>      // create a Time from the Date:
>      var time = new java.sql.Time(widget.getValue().getTime());
>      jxpathPointer.setValue(time);
>    </fb:save-form>
> </fb:javascript>

I'm almost there but it still doesn't work. Now I get:

[quote]
org.apache.commons.jxpath.JXPathException: Exception trying to create
xpath time; Factory
org.apache.cocoon.forms.binding.JXPathBindingBase$BindingJXPathFactory@11185e7
could not create an object for path: /time
[/quote]

I'm not sure, but I think this does not work:
var time = new java.sql.Time(widget.getValue().getTime());

I've also tried
var time = new java.sql.Time(widget.getValue());

and got the same result. Any ideas?


BTW, I have set the path to "/" like in the bean binding examples (I
hope that's ok):

<fb:context xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
	    xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" path="/" >


Thanks,

Paloma
--
Paloma Gomez

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


Mime
View raw message