Tapestry 5 表单内的区域
我有一个表格,里面有一个国家/城市/等选择。
该表单位于区域内。
当调用 onSelected 来更改国家/城市时,返回时我会丢失其他表单数据。我怎样才能保留它?
我认为表单内的区域会有所帮助,但我得到:
表单组件不得放置在其他表单组件内。
Ubigeos 类型只是一个组件,其中包含从 pais select 填充的其他选择
我的 .tml 是
<t:zone t:id="datosPersonalesZone">
<form t:type="form" t:id="formulariodatospersonales" t:zone="datosPersonalesZone">
<t:errors/>
Sexo: <select t:type="Select" t:id="sexo" t:value="actual.sexo" model="sexo" />
País: <input t:type="Select" t:id="pais" model="paises" t:value="pais" t:zone="ubigeosZone"/>
<t:zone t:id="ubigeosZone">
<input t:type="Ubigeos" t:id="ubigeo_nacimiento" t:ubigeo="ubigeoNacimiento" t:zone="ubigeosZone"/>
</t:zone>
</form>
问候 !
I have a form and inside it I have a country/city/etc selection.
The form is inside a zone.
When calling the onSelected for make the change of the country/city, when returning I loose the other form data. How can I keep it ?
I think a zone inside the form would help, but I am getting:
Form components may not be placed inside other Form components.
The Ubigeos type is just a component with other selects that are filled from the pais select
My .tml is
<t:zone t:id="datosPersonalesZone">
<form t:type="form" t:id="formulariodatospersonales" t:zone="datosPersonalesZone">
<t:errors/>
Sexo: <select t:type="Select" t:id="sexo" t:value="actual.sexo" model="sexo" />
País: <input t:type="Select" t:id="pais" model="paises" t:value="pais" t:zone="ubigeosZone"/>
<t:zone t:id="ubigeosZone">
<input t:type="Ubigeos" t:id="ubigeo_nacimiento" t:ubigeo="ubigeoNacimiento" t:zone="ubigeosZone"/>
</t:zone>
</form>
Regards !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您要么必须提交表单并以不同的方式处理国家/地区选择(即仅通过返回块来更新表单内容),要么尝试使用 FormFragment 组件和 TriggerFragment mixin 的想法(可能您不能直接使用它们,但您可以尝试扩展它们以支持选择组件)。
就我个人而言,我选择第一个选项 - 我有一个“SubmitFormOnEvent”混合并将其附加到表单中的 select-s。然后我发现 http://jumpstart.doublenegative.com 演示了类似的方法。 au/jumpstart/examples/javascript/ajaxselect1 ->因此您可以从该示例开始并根据您的需要进行更新。
You either have to submit a form and process country selection differently (i.e. only updating form contents by returning a block) or try using ideas from FormFragment component and TriggerFragment mixin (probably you can't use them directly but you can try extending them to support select components).
Personally, I go with first option - I have a "SubmitFormOnEvent" mixin and attach it to select-s in the form. Then I found that similar approach is demonstrated at http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/ajaxselect1 -> so you just can start with that example and update it to your needs.