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 JavaScriptSupport 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

Reply via email to