I apologize for being so persistent with this question. Has anyone faced this issue before, and is the workaround I've come up with valid? It does work, but I'm new to Cocoon and I wanted to make sure that the fix was appropriate and not a misguided hack.
Thank you! - Hari -------- Forwarded Message -------- From: Hari Selvarajan <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: users@cocoon.apache.org Subject: CForms: <fb:booleanfield> + <fb:union> strangeness Date: Tue, 14 Mar 2006 02:14:04 -0800 Greetings, I'm having some trouble trying to use an <fb:booleanfield> as the case widget for an <fb:union>. The idea was to use a booleanfield that, when checked, would cause two additional fields to be displayed. The form definition and template are both appended below, along with the error message. It appears that JXMacrosHelper expects the value for a union widget to be String-only. There is a cast to String on line 360: String value = (String)unionWidget.getValue(); Would it have the same effect if the line was changed to: String value = unionWidget.getValue() != null ? unionWidget.getValue().toString() : ""; Help!? - Hari Error message + stack trace: ----------------------------------------------------------------------------------------------- org.apache.cocoon.generation.JXTemplateGenerator$JXTException: java.lang.Boolean at <jx:if> - resource://org/apache/cocoon/forms/generation/jx-macros.xml:176:64 at <ft:case> - file:/usr/local/resin-3.0.14/webapps/union-test/1.jx:22:26 at <jx:evalBody> - resource://org/apache/cocoon/forms/generation/jx-macros.xml:164:25 at <ft:union> - file:/usr/local/resin-3.0.14/webapps/union-test/1.jx:21:24 at <jx:evalBody> - resource://org/apache/cocoon/forms/generation/jx-macros.xml:34:23 at <ft:form-template> - file:/usr/local/resin-3.0.14/webapps/union-test/1.jx:12:82 at <map:serialize type="html"> - file:/usr/local/resin-3.0.14/webapps/union-test/sitemap.xmap:137:30 at <map:transform> - file:/usr/local/resin-3.0.14/webapps/union-test/sitemap.xmap:127:50 at <map:transform type="i18n"> - file:/usr/local/resin-3.0.14/webapps/union-test/sitemap.xmap:124:29 at <map:transform type="browser-update"> - file:/usr/local/resin-3.0.14/webapps/union-test/sitemap.xmap:123:40 at <map:generate type="jx"> - file:/usr/local/resin-3.0.14/webapps/union-test/sitemap.xmap:122:40 at resource://org/apache/cocoon/forms/flow/javascript/Form.js:184:-1 at file:/usr/local/resin-3.0.14/webapps/union-test/testunion.js:6:-1 at <map:call> - file:/usr/local/resin-3.0.14/webapps/union-test/sitemap.xmap:114:29 <snip> Caused by: java.lang.ClassCastException: java.lang.Boolean at org.apache.cocoon.forms.generation.JXMacrosHelper.isSelectedCase(JXMacrosHelper.java:360) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.commons.jexl.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:268) at org.apache.commons.jexl.parser.ASTMethod.execute(ASTMethod.java:61) at org.apache.commons.jexl.parser.ASTReference.execute(ASTReference.java:68) at org.apache.commons.jexl.parser.ASTReference.value(ASTReference.java:50) at org.apache.commons.jexl.ExpressionImpl.evaluate(ExpressionImpl.java:86) at org.apache.cocoon.generation.JXTemplateGenerator.getValue(JXTemplateGenerator.java:790) at org.apache.cocoon.generation.JXTemplateGenerator.execute(JXTemplateGenerator.java:2652) ... 60 more ------------------------------------------------------------------------------------------------------------------------------ Form Definition: ------------------------------------------------------------------------------------------------------------------------------ <fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" xmlns:i18n="http://apache.org/cocoon/i18n/2.1"> <fd:widgets> <fd:booleanfield id="enableUnion" required="true"> <fd:true-param-value>true</fd:true-param-value> <fd:label>Check this box to display the union-hidden field</fd:label> </fd:booleanfield> <fd:union id="un1" case="enableUnion"> <fd:widgets> <fd:group id="grp1"> <fd:widgets> <fd:booleanfield id="booleanField1"> <fd:true-param-value>true</fd:true-param-value> <fd:label>Boolean Field 1</fd:label> </fd:booleanfield> <fd:booleanfield id="booleanField2"> <fd:true-param-value>true</fd:true-param-value> <fd:label>Boolean Field 2</fd:label> </fd:booleanfield> </fd:widgets> </fd:group> </fd:widgets> </fd:union> </fd:widgets> </fd:form> Template: ----------------------------------------------------------------------------------------------------------- <html xmlns:ft="http://apache.org/cocoon/forms/1.0#template" xmlns:fi="http://apache.org/cocoon/forms/1.0#instance" xmlns:jx="http://apache.org/cocoon/templates/jx/1.0" xmlns:i18n="http://apache.org/cocoon/i18n/2.1"> <jx:import uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/> <head> <title>Cocoon Union Widget Tester</title> </head> <body> <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST"> <ft:widget-label id="enableUnion"/> <br/> <br/> <ft:widget id="enableUnion"><fi:styling submit-on-change="true"/></ft:widget> <br/> <ft:union id="un1"> <ft:case id="true"> <ft:group id="grp1"> <ft:widget id="booleanField1"/><ft:widget-label id="booleanField1"/> <br/> <ft:widget id="booleanField2"/><ft:widget-label id="booleanField2"/> </ft:group> </ft:case> </ft:union> <br/> <br/> </ft:form-template> </body> </html> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]