You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Norman Franke <no...@myasd.com> on 2010/09/28 21:56:07 UTC
T5: Zone Update Part of Form?
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
Re: T5: Zone Update Part of Form?
Posted by Norman Franke <no...@myasd.com>.
No, 5.1 at present.
Norman Franke
Answering Service for Directors, Inc.
www.myasd.com
On Sep 28, 2010, at 10:11 PM, ningdh wrote:
> Are you using T5.2? I remember T5.2 has supported partial form update.
>
> DH
>
> ----- Original Message -----
> From: "Norman Franke" <no...@myasd.com>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Wednesday, September 29, 2010 6:33 AM
> Subject: Re: T5: Zone Update Part of Form?
>
>
>> 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 <no...@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-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>
>>
>>
Re: T5: Zone Update Part of Form?
Posted by ningdh <ni...@gmail.com>.
Are you using T5.2? I remember T5.2 has supported partial form update.
DH
----- Original Message -----
From: "Norman Franke" <no...@myasd.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Wednesday, September 29, 2010 6:33 AM
Subject: Re: T5: Zone Update Part of Form?
> 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 <no...@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-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>
>
Re: T5: Zone Update Part of Form?
Posted by Norman Franke <no...@myasd.com>.
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 <no...@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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
Re: T5: Zone Update Part of Form?
Posted by Norman Franke <no...@myasd.com>.
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 <no...@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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
Re: T5: Zone Update Part of Form?
Posted by Howard Lewis Ship <hl...@gmail.com>.
FormFragment is the way to go, or its cousin, FormInjector.
On Tue, Sep 28, 2010 at 12:56 PM, Norman Franke <no...@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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org