How to force Rerender even if validation fails?
supernovasoftware.com May 28, 2008 12:20 PMMoved from A4JSF forum.
See http://www.jboss.com/index.html?module=bb&op=viewforum&f=259 for initial posting.
I have read many posts and wiki articles on this and I believe my problem is explained here http://wiki.jboss.org/wiki/RichFacesTwoInputText
I will post some simplified code examples below. This is all done with facelets templates and is not working code. It is only to describe my problem. There are some errors there, but all works in my code except clearing the value from the input components.
I have a data grid that is based on ExtendedDataModel.
I open an edit modal as follows:
<a4j:form id="selectContactForm"> <a4j:commandButton image="images/buttons/edit.gif" title="Edit" action="#{listContactSearch.select(contactL)}" oncomplete="javascript:Richfaces.showModalPanel('editContactPanel',{left:'auto', top:'auto'});" reRender="editContactForm"/> </a4j:form>
Inside the modal panel
<a4j:form id="editContactForm"> <rich:messages id="error" styleClass="hidden"/> <h:panelGrid columns="3"> <h:outputText value="time" /> <h:outputText value="#{currentDate}" converter="versionConverter" id="testCurrentDateOuter" /> <h:outputText value=" " /> <h:outputText value="company:" /> <h:inputText id="company_inputText" value="#{contactEdit.company}" /> <h:outputText id="company_outputText" value="#{contactEdit.company}" /> <h:outputText value="phone:" /> <h:inputText id="company_it" value="#{contactEdit.phone}" /> <h:outputText id="company_ot" value="#{contactEdit.phone}" /> <a4j:commandButton rendered="#{contactEdit.id!=null}" id="updateContact" image="images/buttons/create.gif" oncomplete="windowclose('#{formId}:error','#{panelId}');" title="Update Contact" action="#{listContactSearch.update(contactEdit)}" reRender="editContactForm,contactListGrid" /> <a4j:commandButton rendered="#{contactEdit.id!=null}" id="deleteContact" image="images/buttons/delitem.gif" oncomplete="windowclose('editContactForm:error','#{panelId}');" title="Delete Contact" action="#{listContactSearch.delete(contactEdit)}" reRender="editContactForm,contactListGrid" /> <h:outputText value="?" /> </h:panelGrid> </a4j:form>
Outjects the relevant row to load the form in the modal panel.
action="#{listContactSearch.select(contactL)}"
This works.
I added a outputText that renders the value that is supposed to be in the input field.
contactEdit.company is a String and never fails validation.
contactEdit.phone is a Long and will fail if a letter is typed in this field.
So if I open the modal and cause a JSF validation error for contactEdit.phone, and then close the modal panel and try to edit another contact contactEdit.phone show the new value and matches what the output Text shows for contactEdit.phone. However, contactEdit.company shows the old value in the inputText and the correct value in outputText.
This will cause contact data to be scrambled as there are many other fields relating to the contact and can overlap.
Please help me to understand JSF better so that I can get this to work. I also need to know how to make this work for select components.
I am assuming that one of the other three places, probably the JSF 'local value' described in the wiki article.
Any help would be greatly appreciated.