cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist ...@wrinkledog.com>
Subject Re: [flow+forms] need help w/ binding booleanfield
Date Tue, 14 Jun 2005 19:17:59 GMT

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

> [..snip..]
>
> After I display the form, I call form.save() on the same 
> catalogChoices object, and then I do this:
>
>         var selections = new HashSet();
>         for (i in catalogChoices) {
> 			var lineItem = catalogChoices[i];
>             print (lineItem.selected);	// What's going on here?!?
>             if (lineItem.selected) {	// always true?!
>                 selections.add (lineItem.catalogItem);
>             }
>         }
>         order.setItems (selections);
>
> If I've checked a few of the boxes, here's what gets printed out, e.g.:
>
> 	false
> 	true
> 	true
> 	false
> 	true
>
> ...or whatever.  But... the code in the 'if' statement always runs!
>
> So I'm trying to figure this out, and I added the following code 
> before calling showForm():
>
> 	for (i in catalogChoices) {
> 		print (catalogChoices[i].selected.getClass();
> 	}
>
> Great, it prints 'java.lang.Boolean', as expected.  But then if I add 
> the same code after the call to form.save(), I get the exception 
> "getClass is not a function"!

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! :-)
—ml—


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


Mime
View raw message