Hi,
I'm trying this now, but I'm already stuck on rendering the FormInjector. Form A is submitted with ajax, then I want to rerender a zone containing the FormInjector. This always results in: No object of type org.apache.tapestry5.services.FormSupport is available from the Environment. So I'm not sure on how to render the forminjector. Nathan On 03/05/13 18:36, Lance Java wrote: Disclaimer: I've never used FormInjector before I *think* you can do this but it will require a little trick. The FormInjector adds a trigger() function to it's DOM element. The trigger() function fires a serverside event passing the "context" attribute. In your use case, the context is not known until Form A is posted.So, here's how I think you can do it: 1. User enters values and submits FormA 2. onSuccessFromFormA() 2.1 Save the record to the DB and get an identifier 2.2 Return a Block which renders a FormInjector 2.3 Set the "context" of the FormInjector to the record id 2.4 Use _javascript_Support to fire the FormInjector's trigger() event on the client 3. The FormInjector block renders clientside (zone is inside FormB) 3.1 The _javascript_ from 2.4 fires another serverside event passing the record identifier 4. Serverside event from trigger() 4.1 Lookup the record from the DB using the context 4.2 Return a Block containing a FormFragment 5. The block from 4.2 is inserted before/after the FormInjector |
- Re: Dynamically add fields to form Nathan Quirynen
- Re: Dynamically add fields to form Lance Java
- Re: Dynamically add fields to form Nathan Quirynen