cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <coc...@lojjic.net>
Subject Re: CForms: Time widget binding problem
Date Fri, 14 Jul 2006 03:25:27 GMT
Paloma Gomez wrote:
>> <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]

Hmm, that's strange, it appears JXPath isn't able to do whatever it 
needs to do to create the jxpathPointer (JXPath is still sort of voodoo 
to me ;-) ).  Are you sure the path is correct?  Are you able to save to 
other properties on your bean?

Does the load-form portion work, or are you doing save only?

Maybe try this instead (uses the bean directly rather than jxpath's 
pointer):

<fb:javascript id="time" path=".">
   <fb:load-form>
     widget.setValue(jxpathContext.getNode().getTime());
   </fb:load-form>
   <fb:save-form>
     var time = new java.sql.Time(widget.getValue().getTime());
     jxpathContext.getNode().setTime(time);
   </fb:save-form>
</fb:javascript>


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

Nah, that part should be fine.  The error is happening before the 
javascript is even being executed, while it's setting up the JXPath 
context/pointer.

> 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):

Should be right, as long as you're saving directly to your bean.


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


Mime
View raw message