cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist>
Subject Re: [flow+forms] need help w/ binding booleanfield
Date Tue, 14 Jun 2005 21:07:50 GMT

On Jun 14, 2005, at 12:17 PM, Mark Lundquist wrote:

> Update...
> I instrumented the flowscript code some more, add this after the call 
> to load():
> 	print (catalogChoices[i].selected == 'true');
> ...and this prints "true" for the checkboxes that are checked.  So, 
> it's like it's getting saved as a String by the binding framework!
> Questions:
> 	1) Why would it do that, since I'm specifying a boolean convertor in 
> the binding?
> 	2) ...and if this is what's going on, how come my call to getClass() 
> throws a flowscript exception instead of returning 'java.lang.String'?
> Thanks! :-)

OK, another update... :-)

I just figured out that I actually don't want to use a boolean 
convertor in the binding.  This would be for converting from a String 
on load() and back to a String on save().  (I still don't know why I 
would get 'getClass is not a function' on a String, but it doesn't 
really matter now :-).

OK, so... convertor is gone from the binding file.  But the test

	if (lineItem.selected)

still always evaluates to true, no matter if checkbox was checked or 

But... if I change it to this:

	if (lineItem.selected == true)

then it works!

So, I'm all confused because I don't know what object type I am really 
dealing with here in the flowscript nor the best idiom for coding with 
it.  Any suggestions?

(Also, if I put the getClass() instrumentation back in, now what 
happens is that as it iterates through the items it prints 
'java.lang.Boolean' for unchecked checkboxes until it reaches one that 
is checked, and then it throws the "getClass is not a function" error).

Some might say that the wrong idiom here is my use of the binding 
framework to bind to a flowscript object instead of to a "real bean" 
from my model layer, and that I should be accessing widgets directly 
for information that is only used in the controller layer.  But I 
wanted to experiment with this style and see how things went, because I 
think it can make the flowscript code clearer and simpler, especially 
when dealing with repeaters.  Essentially, I'm using a Javascript 
object as an ad hoc, lightweight DTO.


View raw message