pon*_*zao 5 java ajax tapestry
我有一个Zone内部 a Form,Zone它更新了一个包含输入字段的块,我想将其绑定到 parent Form。不幸的是,这似乎并不像我希望的那么容易,因为我收到了以下错误消息。
The Description component must be enclosed by a Form component. [at classpath:...Page.tml, line 100]
Run Code Online (Sandbox Code Playgroud)
源代码的简化版本.tml如下。
The Description component must be enclosed by a Form component. [at classpath:...Page.tml, line 100]
Run Code Online (Sandbox Code Playgroud)
有没有办法进行绑定,如果没有,还有哪些其他选择?
这个答案已经过时了,您可以使用Tapestry 5.2 上的常用区域功能添加表单元素。不过,这种方法仍然有效。
该FormInjector组件允许您将表单元素添加到现有表单中。不过,您必须编写一些自定义 JS 来触发表单注入。
在您的 TML 中:
<div t:type="FormInjector" t:id="injector" position="below" />
Run Code Online (Sandbox Code Playgroud)
您可以像这样在 JS 代码中触发注入:
$('theClientIdOfMyFormInjector').trigger();
Run Code Online (Sandbox Code Playgroud)
您可以通过类名 ( ) 在表单中找到注入器 DIV myForm.down('div.t-forminjector')。
组件类:
@Inject
private Block formFieldsBlock;
@OnEvent(component = "injector")
Block loadExtraFormFields() {
return this.formFieldsBlock;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4057 次 |
| 最近记录: |