Fórum

liferay-ui:form-navigator with files that include liferay-ui:input-editor

Shira Rand, modificado 11 Anos atrás.

liferay-ui:form-navigator with files that include liferay-ui:input-editor

New Member Postagens: 15 Data de Entrada: 13/02/13 Postagens Recentes
I'm trying to use form-navigator with a bunch of files that include input-editor in them.

On the first page I have the following code:
<aui:form action="<%=actionURL%>" method="post" name="fm">
<liferay-ui:form-navigator categoryNames="<%=categoryNames%>" categorySections="<%=categorySections%>" jspPath="/html/portlet/sections/" />
</aui:form>

categoryNames and categorySections are defined before the form.

The section pages all have this kind of include:

<liferay-util:include page="/html/portlet/sections/editor.jsp" servletcontext="<%=this.getServletContext()%>">
  <liferay-util:param name="editorName" value="<%=editorName%>" />
</liferay-util:include>

The editor.jsp file looks like this (with extra content before and after):
<aui:input name="<%=editorNameContent%>" type="hidden" />

<aui:field-wrapper>
  <liferay-ui:input-editor name="<%=editorName%>" initMethod="<%=editorInitMethod%>" onChangeMethod="<%=editorOnChangeMethod%>" />

    <script type="text/javascript">
    function <portlet:namespace /><%=editorInitMethod%>() {
        return jQuery("#<portlet:namespace /><%=editorNameContent%>").val();
    }

    function <portlet:namespace /><%=editorOnChangeMethod%>() {
        var editorContent = window.<portlet:namespace /><%=editorName%>.getHTML();
        jQuery("#<portlet:namespace /><%=editorNameContent%>").val(editorContent);
    }
    </script>
</aui:field-wrapper>

The other variables are defined according to the editorName parameter. For example, String editorNameContent = editorName + "Content".

I would expect it to work fine, but when I run this I get only the editors one below the other and the form-navigator is below them and doesn't work.
If I remove the init method I get the content of the included page inside the editors.

When removing the input-editor everything works fine.
When putting the editor directly inside the section it works as expected, but it's a lot of duplicated code and a maintenance hell.

Does any one have an idea why it happens and how it could be solved?
At the moment I duplicated the code as that is the only solution I could find.

Thanks,
Shira
Shira Rand, modificado 11 Anos atrás.

RE: liferay-ui:form-navigator with files that include liferay-ui:input-edit

New Member Postagens: 15 Data de Entrada: 13/02/13 Postagens Recentes
I guess you could say this about Liferay: "Expect the unexpected".

If I remove the init method I get the content of the included page inside the editors.

This part was the key to solving the issue.
Turns out that the editor names were the file names so the input editor decided to include them as its content and ruin the layout.

I don't know how anyone could expect that to happen as there is no documentation (that I could find) about this behaviour.