form with nested tabular fields and disappearing error messages
raster3 Oct 24, 2013 10:07 PMHi,
I have a form with 3 panels:
Panel 1 has a some fields arranged like in a normal form.
Panel 2 has a table with input fields.
Panel 3 has some buttons that are enabled on table row selection and some buttons allow move up /down/ delete of rows
It mostly works well. There is just one small problem.
Error messages related to the fields in the Panel1 disappear from <rich:messages ajaxRendered="true" id="mainmessages" /> if the table in Panel2 has a selection listener and the table is selected on a row that is not currently selected.
Any suggestion?
I was able to get some kind of a partial solution by changing the listener configuration to
<a4j:ajax limitRender="true" event="selectionchange" listener="#{tableD.selectionListener} render="controls message mainmessages" />
I am looking for a cleaner and better solution.
Any help will be appreciated.
I have also tried using JSR303 with no improvements.
R
<h:form id="form" > <rich:messages ajaxRendered="true" id="mainmessages" /> ....... <!-- Panel 1 --> <h:panelGrid columns="3"> <h:outputText value="Field1" /> <h:inputText value="#{tableD.field1}" id="field1" validator="#{tableD.validateField1}"> <a4j:ajax event="change"/> </h:inputText> <rich:message for="field1" /> </h:panelGrid> ...... <!-- Panel 2 --> <rich:extendedDataTable selection="#{tableD.selection}" style="width:735px; height:245px" selectionMode="single" id="tableColumns" columns="8" value="#{tableD.rows}" var="record" rowkeyVar="rowkey" > <a4j:ajax event="selectionchange" listener="#{tableD.selectionListener}" render="controls message" /> <rich:column width="150px"> <f:facet name="header">Name</f:facet> <h:inputText value="#{record.name}" id="recordName" validator="#{tableD.validateRecordName}" > <f:attribute name="recName" value="#{record.name}" /> </h:inputText> <rich:message for="recordName" /> </rich:column> ...... </rich:extendedDataTable ...... <!-- Panel 3 --> <rich:panel style="width:600px;" id="controls">... contains some buttons that get enabled on row selection </rich:panel> ---- </h:form>