@Seamus
actually what I am doing now is using the name attribute of the form (it
does not change) to refer to the form in js.
this works, but it feels like a workaround.
I think the ids should not be changend by tapestry. I don't see the id
clash here. maybe I am blind ... should be an optional feature.
@Dragan
I did exactly as you described for the form and for the zone already but
the id is still changing. your second approach might work but I have to
remove my binding on the js side and bind it again with the new id.
I don't really like that extra code. the ids should not change in the
first place (unless it is really necessary. in a loop for example).
however your approach is better than my name attribute workaround.
I have to try it later. thank you very much!
Andreas
Dragan Sahpaski schrieb:
Hi,
On Mon, Dec 12, 2011 at 9:38 AM, Andreas Bohnert<a...@weberhofer.at> wrote:
Thanks Dragan for your quick response!
I have tried 2. und 3. but I still get the random id for my form (I have
bound the .submit() to an button pressed event, so I can not do 1.).
I just wonder why your focus is on the zoneId (and not on the formId),
because my zoneId do not change after the zone update.
Sorry I wrote the reply as I was just going out so didn't answer your
question exactly right.
If you don't want tapestry to change the id of the form just bind it to a
property expression like this.
Tml
<form t:type="Form" t:id="loginForm" id="${formId}" />
Java
public String getFormId(){
return "myformid";
}
and in the javascript also
$('${formId}').submit();
Also if you want tapestry to make the change and use the generated id. Than
leave the form id as is in you example and then just. In this case the form
should be rendered before the javascript so tapestry generated the id
already.
Java
@InjectComponent
private Form loginForm;
public String getFormId(){
return loginForm.getClient();
}
and in the javascript also
$('${formId}').submit();
Hope this answers it right.
Cheers,
Dragan Sahpaski
regards,
andreas