facesMessages.addToControl() fails in rich:modalPanel components
jakec Jun 26, 2008 1:57 AMI am trying to get validation working in a rich:modalPanel. I have been using facesMessages.addToControlFromResourceBundle() successfully until now.
main.xhtml
<ui:composition xmlns=...> <ui:define name="body"> <a:include viewId="modal.txml"/> .... <h:form id="infoForm"> <a:commandLink id="editInfo" value="Edit Info" action="#{myBean.editInfo(currentInfo)}" oncomplete="Richfaces.showModalPanel('modalPanel');" reRender="modalPanelDiv"/> </h:form> </ui:define> </ui:composition>
modal.txml
<ui:composition xmlns=...> <rich:modalPanel id="modalPanel" autosized="true" zindex="2000"> <h:form id="editForm"> <s:validateAll> <s:div id="modalPanelDiv"> <s:decorate id="nameDecor" template="edit.txml"> <ui:define name="label">Name:</ui:define> <h:inputText id="name" value="#{myBean.name}"/> </s:decorate> <a:commandButton id="abandon" image="/img/button/abandon.gif" action="#{myBean.abandonEdits}" title="Abandon Changes" oncomplete="if(#{myBean.closingModalWindow}) Richfaces.hideModalPanel('modalPanel'); return false;"/> <a:commandButton id="submit" image="/img/button/done.gif" action="#{myBean.commitEdits}" title="Commit Changes" oncomplete="if(#{myBean.closingModalWindow}) Richfaces.hideModalPanel('modalPanel'); return false;" reRender="dataTable,dataDetails"/> </s:div> </s:validateAll> </h:form> </rich:modalPanel> </ui:composition>
MyBeanBean.java
... public void commitEdits() { closingModalWindow = true; if(// Detect invalid entry//) { facesMessages.addToControlFromResourceBundle("name", "nameValidationError3"); closingModalWindow = false; } } ...
output
INFO [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed. sourceId=j_id49:editForm:nameDecor:name[severity=(ERROR 2), summary=(nameValidationError3), detail=(nameValidationError3)]
Of course, no validation message appears. When I examine the generated html with FireBug, the ID of the field is indeed j_id49:editForm:nameDecor:name
. Even basic Hibernate validation throws the above warning.
I use the same edit.txml all over our site, as well as ui:include. This is my first a:include and rich:modalPanel, however.