Eh, it may be because I'm not updating the correct currentSetting object.
 The behavior I want to support is fairly simple, but seems to be quite
complex to get working in Tapestry, unless I'm missing something.

On Mon, Jul 11, 2011 at 1:12 PM, Ray Nicholus <rnicho...@widen.com> wrote:

> It sounds like I can't use a submit button at all in this case.  If I
> update the first select this in turn updates the 2nd select via a zone
> update.  Then, when I choose a new value in the 2nd select and hit submit,
> my newly selected value is not persisted.  Instead, the default value of the
> select is persisted.
>
>
> On Mon, Jul 11, 2011 at 1:01 PM, Josh Canfield <joshcanfi...@gmail.com>wrote:
>
>> > Sorry for not noticing that. IFIAK you wont be able to use loop
>> > variable(value parameter in loop or ajaxforloop) during a non-submission
>> > ajax call.
>>
>> You can use the variable, you just can't count on it being set for you
>> when you're using it out of context of the loop. Encode enough
>> information in your events that you can re-hydrate your required
>> properties yourself.
>>
>>
>>
>> On Mon, Jul 11, 2011 at 10:39 AM, Taha Hafeez <tawus.tapes...@gmail.com>
>> wrote:
>> > Sorry for not noticing that. IFIAK you wont be able to use loop
>> > variable(value parameter in loop or ajaxforloop) during a non-submission
>> > ajax call. In case of a loop, the context of each iteration(i.e the loop
>> > variable) is stored in hidden fields in the form. A value-encoder is
>> used to
>> > convert the current loop variable into a client side string and on
>> > submission the same value-encoder converts it back into the loop
>> variable
>> > which is used to set the value of each form field in an iteration. Now
>> if
>> > you make an ajax call which only refreshes a zone inside the loop, the
>> > current loop value(currentSetting in our case) is null as the decoding
>> using
>> > value-encoder does not happen without a submission.
>> >
>> > regards
>> > Taha
>> >
>> >
>> > On Mon, Jul 11, 2011 at 10:37 PM, Ray Nicholus <rnicho...@widen.com>
>> wrote:
>> >
>> >> I'm not sure what variable you are talking about.  Do you mean
>> >> "currentSetting"?  There is no "currentSettings" variable.  If so,
>> >> currentSetting is the variable set by the ajaxformloop so there is
>> nothing
>> >> for me to initialize there.
>> >>
>> >> On Mon, Jul 11, 2011 at 12:04 PM, Taha Hafeez <
>> tawus.tapes...@gmail.com
>> >> >wrote:
>> >>
>> >> > My first question was where have you initialized currentSettings. Say
>> you
>> >> > have initialized it in onPrepare(), then during an ajax call, this
>> method
>> >> > is
>> >> > not called and so currentSettings is not initialized for that
>> request. If
>> >> > you are setting it in setupRender() of the main component, then as
>> only
>> >> an
>> >> > internal zone is updated, setupRender() or beginRender() of main
>> >> > component/page are not called for ajax update of an internal zone.
>> >> >
>> >> > So you have to be careful about where you setup currentSettings and
>> >> whether
>> >> > that phase is called during ajax update. In case it is not, then you
>> have
>> >> > to
>> >> > keep the variable in session so that you can use it across multiple
>> >> > requests.
>> >> >
>> >> > regards
>> >> > Taha
>> >> >
>> >> >
>> >> > On Mon, Jul 11, 2011 at 10:17 PM, 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