You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by m!g <ga...@gmail.com> on 2011/01/19 11:00:06 UTC
Tapestry 5.2 Disable element id autogeneration
Hi everyone.
How can I disable autogeneration of form ids? I have a form which is located
inside zone.
JAVA:
....
@Component(parameters = { "id=literal:registrationFormZone", "update=show"
})
private Zone registrationFormZone;
@Component(id="registrationForm", parameters = {
"id=literal:registrationForm", "clientId=literal:registrationForm",
"clientValidation=false", "zone=registrationFormZone" })
private Form registrationForm;
...
TML:
<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
<div t:id="registrationFormZone">
<form method="post" t:id="registrationForm">
<p>Логин (e-mail): <input class="input" type="text" t:id="email" /></p>
<p>Пароль: <input class="input" type="password" t:id="password" /></p>
<p><input disabled="false" t:type="submit" class="Go golite regGo"
value="Принять и зарегистрироваться" /></p>
</form>
</div>
</t:container>
Result HTML:
<div id="registrationFormZone" class="t-zone">
<form id="registrationForm_12d9dac2ead" method="post"
action="/shop/products.template.template.loginregisterform.registrationformcomponent.registrationform"
clientid="registrationForm" class="t-prevent-submission">
....
</form>
</div>
After the first submit the content of zone is updated and form has another
id:
<div id="registrationFormZone" class="t-zone">
<form id="registrationForm_12d9dad0b88" method="post"
action="/shop/products.template.template.loginregisterform.registrationformcomponent.registrationform"
clientid="registrationForm">
And the second submit will not send data via AJAX (may be the event assigned
to submit button is linked to old id and not valid anymore).
I looked into the sources of Form.class:
void beginRender(MarkupWriter writer)
{
....
clientId = javascriptSupport.allocateClientId(resources);
May be it would be better to add parameter clientId and check if user didn't
assign custom id make it automatically?
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-Disable-element-id-autogeneration-tp3347539p3347539.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry 5.2 Disable element id autogeneration
Posted by m!g <ga...@gmail.com>.
I've made a little fix in Form component:
....
/**
* Id parameter
*/
@Parameter
private String id;
....
void beginRender(MarkupWriter writer)
{
....
if (null != id && !"".equals(id.trim())) {
clientId = id;
} else {
clientId = javascriptSupport.allocateClientId(resources);
}
....
and it works fine now.
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-Disable-element-id-autogeneration-tp3347539p3347966.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry 5.2 Disable element id autogeneration
Posted by m!g <ga...@gmail.com>.
Entire form is inside the zone component, including submit button.
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-Disable-element-id-autogeneration-tp3347539p3347955.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry 5.2 Disable element id autogeneration
Posted by LLTYK <LL...@mailinator.com>.
Put the submit button inside the zone as well, then it will link to the new
id.
--
View this message in context: http://tapestry-users.832.n2.nabble.com/Tapestry-5-2-Disable-element-id-autogeneration-tp5938959p5939355.html
Sent from the Tapestry Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org