Tuesday 19 May 2015

JSF Buttons Nested in a Repaintable Elements

There was a little bug in posts where any unsaved fields would be lost when removing a tag from the tag list. This happened because each tag element had <f:ajax render="@form" /> set.

Setting the JSF <f:ajax render="tags-output" /> had not facilitated the repainting of  the tag list. This was a problem and I thought <f:ajax render="@form" /> was the solution.

Armed with new knowledge about JSF  I have prefix the panelGroup's id with the form's id.

Now the bug has gone and the problem is solved.
    <ui:repeat var="t" value="#{postWriter.post.tags}">
        <h:commandButton
            value="#{t}"
            action="#{postWriter.removeTag(t)}"
        >
            <f:ajax
                render="posts:tags-output posts:tags"
            />
        </h:commandButton>
    </ui:repeat>

No comments:

Post a Comment