On Wed, Jun 16, 2004 at 10:53:38AM -0600, Johnston, Jason wrote: <snip/> > I've dug into the source and found that on line 61 of > src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Union.java it > finds the widget to use for the case by calling: > > caseWidget = ((ContainerWidget)getParent()).getChild(caseWidgetId); > > It seems to me that replacing .getChild() with .lookupWidget() would > allow the case="" attribute to take a relative path to find the proper > field and allow me to do what I want. > > Is this the correct approach? Would it cause other problems I can't see > with my limited knowledge of the code?
Working from memory alone, I only see three issues: * Where do you want the lookup to be relative to? Probably relative to the parent (like I think you are suggesting) would make the most sense. * There may be sequence of execution issues if the widget you reference is defined below (further down the file) than the union itself, as in the case-determining widget's request parameter may not have been processed in time to contribute to the union's case selection process. You will need to test this and either document the limitation or design some way for this dependecy to reorder the request parameter processing to eliminate the problem. * The union widget is being redesigned and will be replaced by "choice" described here: http://wiki.cocoondev.org/Wiki.jsp?page=WoodyScratchpad The good news is we can probably reuse the good solutions you come up with for the union widget when we implement "choice/case". --Tim Larson
