Hi Ben!
Any particular reason why you need bind for capturing the change event
of a select?
This works for me (honestly not tried in a AjaxFormLoop, so don't kill me):
<t:select class="input-small" t:id="schoolFinderSearchOption"
t:validate="required"
blankOption="Always"
value="schoolFinderSearchOptionValue" zone="schoolFinderZone"/>
as schoolFinderSearchOptionValue is defined as an Enum Property
@Property private ESchoolFinderSearchOption
_schoolFinderSearchOptionValue;
therefore Tapestry calls
Object onValueChanged(final ESchoolFinderSearchOption esfso)
{
....
}
I guess due to the fact you have a zone and a jquery/bind at the same
time you are getting two calls. In case you solely use bind you can send
the current value as part of the request by adding a callback (this
snipped is working for me in an AjayFormLoop with a checkbox, so please
modify it accordingly for your "input field of type select"):
bind.event="deleteCheckboxChanged"
bind.eventType="change"
bind.callback="function(event,ui,url) {
url.addContext(event.target.checked); }"
and this calls
Object onDeleteCheckboxChanged(final long formEventPk, final String
state) // you can even use: ..., final boolean state) instead
of string
{
...
}
Jens
Am 28.05.13 13:48, schrieb Ben Titmarsh:
Hi All,
I am using the jQuery bind mixin to respond to 'onChange' events from my form
fields, process the change then update the zone. This is my tml:
<t:select t:id="superTypeOverride" t:clientId="superTypeOverride"
t:value="cubeCard.superTypeCombinationOverride"
t:mixins="jquery/bind"
bind.context="cubeCard.id"
bind.event="SuperTypeOverrideChanged"
bind.eventType="change"
bind.zone="gridZone" t:zone="gridZone" />
I have a bunch of these created in a loop, each with a different cubeCard.id
context value.
What I'm seeing is that when the value of the field is changed, two requests
are produced:
1. /editcube:supertypeoverridechanged/49
2. /editcube.supertypeoverride:change
The first one contains the important context value and the second one contains
the changed value of the form field in the Request body. I can add a handler
for both in my page class:
1. public Object onSuperTypeOverrideChanged(Integer cubeCardId)
2. public void onChangeFromSuperTypeOverride()
But the problem is that I need the context AND the submitted value, therefore
what I'm having to do is basically wait for the second request to be processed
and the value set on the server side before I can process the request
containing the context:
public Object onSuperTypeOverrideChanged(Integer cubeCardId) {
Thread.sleep(200);
//processing
return gridZone.getBody();
}
Clearly this isn't ideal. So, am I doing something wrong here? Should I be
getting two requests or just one? Is there anyone else who has experience with
this mixin who can help me out?
Thanks,
Ben.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org