我开始使用liferay-auto-fields合成物。
这是我的带有aui:script的jsp->
<aui:form action="<%=saveMotiveURL%>" name="fm" method="post" enctype="multipart/form-data" onSubmit="setZones()" >
<aui:fieldset>
<aui:field-wrapper>
<div id="emailAdress-fields">
<label class="control-label"><liferay-ui:message key="motiveConfigEdit.col5"></liferay-ui:message> </label>
<div class="lfr-form-row lfr-form-row-inline">
<div class="row-fields">
<aui:input type="text" name="emailAdress1" fieldParam='emailAdress1' id='emailAdress1' label="" value=""/>
<aui:input type="hidden" name="motiveEmailId1" fieldParam='motiveEmailId1' id='motiveEmailId1' value=""/>
</div>
</div>
</div>
<aui:button type="submit" name="saveButton" value="button.create" label=""/>
</aui:field-wrapper>
</aui:fieldset>
</aui:form>
<aui:script>
AUI().use('liferay-auto-fields',function(A) {
new Liferay.AutoFields(
{
contentBox: '#emailAdress-fields',
fieldIndexes: '<portlet:namespace />rowIndexes'
}
).render();
});
</aui:script>
然后,我想在processaction函数中检索“ rowIndexes”,所以我做了:
String rowIndexes = actionRequest.getParameter("rowIndexes");
这总是让我有空。 我还注意到,当我通过单击“ +”按钮创建自动字段时,jsp“ rowIndexes”中的隐藏字段不会更改或没有值。
有人可以解决吗?
谢谢
答案 0 :(得分:0)
您要解决的代码有几个问题,
喜欢
之类的标签 <liferay-frontend:edit-form>
<liferay-frontend:edit-form-body>
<liferay-frontend:fieldset-group>
<liferay-frontend:fieldset>
以下结构应适用于最新版本的Liferay:
<liferay-frontend:fieldset >
<div id='emailAdress-fields'>
<div class='lfr-form-row lfr-form-row-inline'>
<div class='row-fields'>
</div>
</div>
</div>
</liferay-frontend:fieldset>
您的脚本看起来不错
<aui:script use='aui-base'>
A.use('liferay-auto-fields',function(A) {
new Liferay.AutoFields({
contentBox: '#emailAdress-fields',
fieldIndexes: '<portlet:namespace/>rowIndexes'
}).render();
})
</aui:script>