thanks guys, defer="false" works fine.

josh, i do want the other form fields to save their values as part of this operation.

cheers, p.

On 17/05/2011 3:39 AM, Josh Canfield wrote:
defer="true"
This is the right place to look, but the wrong value. True is the
default and tells the submit to hold off notifying it's container
about it's click until all of the rest of the form elements have been
processed.

In this case the submit components are getting their context from the
loop values. Since the submit is deferred the loop values have changed
by the time the notification is made. If you set defer=false then
you'll get the notification at the next heartbeat (most likely the end
of the loop) and the loop values won't have changed.

This seems like a defect. Perhaps submit should be more loop aware and
evaluate it's context and store it to the side when the submission is
processed. I haven't checked to see if it's already filed.

Depending on what you are doing you might consider using an event
link, or moving the form inside the loop, so that clicking remove
doesn't have to send back all of the information for elements you
don't care about...

Also, consider this syntax:
  t:context="[location]"
When you use ${} for prop bindings you end up converting the value to
string unnecessarily.


Josh

On Mon, May 16, 2011 at 2:48 AM, Gerold Glaser<gerold.gla...@gmail.com>  wrote:
Hi Paul!

Have a look on the defer param of the submit component.

I think your submit component should look like:
<t:submit t:event="RemoveLocation" t:context="${location.hashCode()}"
defer="true"/>

Best regards,
Gerry

2011/5/16 Paul Stanton<p...@mapshed.com.au>

Tapestry 5.1.0.5

Hi all,

I'm having a problem with the following code:

<t:form t:id="locationsForm" t:zone="myZone">
<t:loop t:source="locations" t:value="location"
t:encoder="locationEncoder">
<t:textfield t:value="location.name" />
<t:submit t:event="RemoveLocation" t:value="remove ${location.hashCode()}"
t:context="${location.hashCode()}" />
</t:loop>
<t:submit t:value="save" />
</t:form>

Say I end up with the following buttons:

<input type="submit" name="button" id="button" value="remove 12339020">
<input type="submit" name="button" id="button" value="remove 2504658">

Clicking on either button will only ever trigger the event
'onRemoveLocation' with the context '2504658'.

I'm guessing the second submit component is overriding the event handler
registered by the first, so they both end up calling the second components
event handler.

I have tried setting the clientId to something unique but that did not
help.

I need the remove buttons to submit the same form since the user may update
the name of one element and remove the second in the same operation.

Advice appreciated, p.

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


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



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

Reply via email to