> I guess I'm confused about why I need to worry about any of this.  Without
> the zone parameter, I have no problem changing values of my selects.

You have to worry about it because without the zone parameter you
aren't doing an ajax request back to your component when the select
changes. When you add the zone parameter to the select it has to
actually make a request back to the server to render the zone and your
"currentSetting" object is null when it comes time to render because
it's only getting set if you're running through the AjaxFormLoop.

The select component only notifies your server about the new value of
the select. You probably need to encode enough information into your
select value that you can figure out which select you want to render.

You also need to provide an "id" attribute/parameter to your zone
(instead of or in addition to your t:id attribute). This will keep
your zone id at a fixed value that you can reference from your select.
Since you're in a loop you are rendering the zone multiple times and
it's going to get multiple ids, you should control what those ids are.
You could use the id of your currentSetting if it's unique, otherwise
you'll have to come up with something.

It can be as simple as:


<t:zone id="${currentSelect.id}_selectZone" ... >
</t:zone>

<t:select zone="${currentSelect.id}_selectZone" ... />

Josh

On Mon, Jul 11, 2011 at 9:47 AM, Ray Nicholus <rnicho...@widen.com> wrote:
> Hello Taha,
>
> I guess I'm confused about why I need to worry about any of this.  Without
> the zone parameter, I have no problem changing values of my selects.
>  However, I need the zone so that I can change the available options in the
> 2nd select after the value changes in the first select.  Shouldn't I just be
> able to refresh the 2nd select via a zone update?
>
> On Mon, Jul 11, 2011 at 11:26 AM, Taha Hafeez <tawus.tapes...@gmail.com>wrote:
>
>> Hi Ray,
>>
>> Where are you initializing currentSetting.fileMetadataTyp?e and is this
>> value @Persisted as you are using it across multiple requests.
>>
>> regards
>> Taha
>>
>> On Mon, Jul 11, 2011 at 9:19 PM, Ray Nicholus <rnicho...@widen.com> wrote:
>>
>> > Here is a fragment of some template code inside of a tapestry form:
>> >
>> > <t:ajaxformloop t:id="existingAutoImportSettings"
>> source="existingSettings"
>> > value="currentSetting">
>> >  <t:label for="typeSelect"/>
>> > <t:select t:id="typeSelect" zone="fileMetadataSelectZone"
>> > value="currentSetting.fileMetadataType" label="${message:type}"/>
>> >
>> > <t:zone t:id="fileMetadataSelectZone">
>> > <t:label for="fileMetadataSelect"/>
>> >  <t:select t:id="fileMetadataSelect"
>> > value="currentSetting.fileMetadataObject"
>> >  model="autoImportFileMetadataModel" label="${message:file-metadata}"/>
>> >  </t:zone>
>> >
>> >                                          ..........
>> >
>> > </t:ajaxformloop>
>> >
>> > <input type="submit" value="Update"/>
>> >
>> >
>> > As soon as I add the zone parameter to the 1st select & reload, I get a
>> NPE
>> > when I attempt to change the value in the 1st select.  It claims that the
>> > currentSetting value is null when attempting to evaluate
>> > currentSetting.fileMetadataType.
>> >
>> > What am I doing wrong?
>> >
>>
>

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

Reply via email to