Well, I'm not sure FormInjector will work without a lot of work. I need to pass in the value of the one field and it's not clear how do to that. The activate() method doesn't take any parameters.

For anyone else who wants to do this, here is what I did:

1. Make the zone update the ENTIRE form, which is a pain since you can't do javascript or CSS hooks by form element ID, one has to use class or something else. (Since the IDs change after the AJAZ update.)

2. Use Form.serialize to save all form values before actually triggering the AJAX update.

3. Listen for Tapestry.ZONE_UPDATED_EVENT on the zone div and re- initialize everything in the listener. I had to re-initialize listeners on form fields since they are all reset after the update. One needs to use $$('select.selectClass)[0] instead of the easier $ ('selectId') when passing to Event.observe.

4. In the event listener for the zone update, deserialize the form using the handy library: http://madchicken.altervista.org/tech/2006/02/prototype-form-serialization-and.html

This appears to behave as desired, although it's rather round-about.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



On Sep 28, 2010, at 5:15 PM, Norman Franke wrote:

FormFragement doesn't work either since it doesn't have a Form in the Environment at AJAX render time.

I'll look into FormInjector, although I may just end up updating the entire form, although values entered into the form before the update are lost.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



On Sep 28, 2010, at 4:55 PM, Howard Lewis Ship wrote:

FormFragment is the way to go, or its cousin, FormInjector.

On Tue, Sep 28, 2010 at 12:56 PM, Norman Franke <nor...@myasd.com> wrote:
I want to update part of a form based on what they enter in the first field. What's the best way to do this? Apparently, I can't update a zone inside a form that contains form fields because there is no form in the Environment,
so rendering fails.

Will creating two forms or nested forms work? I tried a formfragment, but
that didn't work either.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com







--
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Reply via email to