Thanks for your great help Mark!!! Performance isn't an issiue. Just some work for my university of applied sciences. It only has to run.
cheers Jonny > --- Ursprüngliche Nachricht --- > Von: Mark Lundquist <[EMAIL PROTECTED]> > An: [email protected] > Betreff: Re: Forms and JXTemplate > Datum: Fri, 1 Jul 2005 11:30:08 -0700 > > On 2005-07-01 07:28:07 -0700, "Johannes Becker" <[EMAIL PROTECTED]> > said: > > > One answer that was posted by Mark: > > You can generate your form definition files using jxtemplate (in a > cocoon > > pipeline). Then when you want to reference your definition file, use > > cocoon:// to access it. > > > > > > My problem: I don't know how to implement this. I was looking for > > samples, but I > > couldn't find any. > > > > Could anyone please post me a simple example how to implement this. > > Make a template file to generate your form definition, e.g. > "form-definition.jx". In there you write the markup just exactly like > in your original post, e.g.: > > <fd:validation> > <fd:range min="5" max="#{number/max}"/> > </fd:validation> > > In your sitemap: > > <match pattern="get-form-definition"> > <call function="getFormDefinition"/> <!-- this would > probably have > some parameters too, whatev... --> > </match> > . > . > . > <match pattern="generate-form-definition"> > <generate type="jx" src="form-defintion.jx"/> > <serialize type="xml"/> > </match> > > Add this flowscript: > > function getFormDefinition() { > . > . > . > cocoon.sendPage ( > 'generate-form-definition', > {'number': {'max': 42}} // or any bean > or JS object w/ these > properties... > ); > } > > ...and finally in your form controller flowscript: > > var form = new Form ('cocoon:/get-form-definition); > > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-= > > That should get you going. Although as i said before, I don't feel > that this is a great approach. It just smells funny to me. Too > complicated for the problem you're trying to solve. And performance > will not be great, because a dynamically-generated form definition > can't be cached. Doing this validation by hand is not hard, and if you > do then the form definition itself is static, and will be cached once > it's been parsed the first time. > > But, suit yourself... :-) > > cheers > âmlâ > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- 5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail +++ GMX - die erste Adresse für Mail, Message, More +++ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
