Hi,
From my experience, there is a "problem" for components which cause
events which are enclosed in a loop.
Tapestry will use the dom nesting for the component event url, and thus,
it is always the last (at least in my case) of the components which is
triggered by the event.
The solution is to pass a context to each event and assure this context
is different for each iteration of the loop.
Kind regards,
Joachim
tapestryphoto wrote:
This looks similar to my problem (see both of my posts from a day or
so ago). It appears Loops in a Form do not update the properties.
Perhaps this is broken in Tapestry. I guess it must be a bug.
Unfortunately I'm not knowledgeable enough about Tapestry to provide
an answer and I await someone who is.
p.
Quoting Andy Pahne <[EMAIL PROTECTED]>:
I am trying to edit the properties of objects contained in a list by
using a loop in a form component. But it does not work, because the
objects in the list are not updated.
The list of passengers:
@Property @Persist
private List<Passenger> passengers;
This list is initialized like this:
@BeforeRenderTemplate
public void initialize() {
int passengersTotal = getQuery().getPassengersTotal();
if(passengers == null) {
passengers = new ArrayList<Passenger>(passengersTotal);
for (int i = 0; i < passengersTotal; i++) {
passengers.add(new Passenger());
}
}
}
I try to buid a form in order to edit the passengers like this:
<form t:type="Form"
t:id="search_accommodation"
t:clientValidation="false"
t:autofocus="false">
<t:loop source="passengers" value="passenger">
<fieldset class="column first">
<legend>${message:firstName-label}</legend>
<input type="text"
t:type="TextField"
t:value="passenger.firstName"
t:validate="required,minLength=2"
t:id="firstName"/>
</fieldset>
</t:loop>
</form>
Unfortunatly, after a successful submit, the firstName property is not
set for any of the passengers contained in that list. I veryify that by
the following logging statements:
public void onSuccess() {
int passengersTotal = getSearchOptions().getPassengersTotal();
for (int i = 0; i < passengersTotal; i++) {
System.out.println("Passenger '"+i+"'" + ": " +
passengers.get(i).getFirstName());
}
}
which always produces the output:
Passenger '0': null
Passenger '1': null
I thought that this would be the way to go, but I must be wrong
somehow. Could anybody tell me what's the correct pattern to use here?
Thank you,
Andy
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Joachim Van der Auwera
PROGS bvba, progs.be
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]