jsf 2 - JSF inputText's value reappears after clearing it -
i have validate h:inputtext has value. there i'm using required="true" on component. job , works, strange happens.
when leave blank, required="true" happens. when type text in inputtext, required="true" not happen. when i, after adding text, remove text required="true" happens, entered value reappears in inputtext.
i don't have got idea be. note when i'm saying "required="true"" happens, mean border of inputtext gets red (see code).
here code:
<h:form id="generateletterform"> <h:panelgroup id="submitterpanel"> <h:panelgrid styleclass="rsplitpanel1" columns="1"> <e:inputtext entitybb="#{entitybb}" type="#{type}" property="submitterfirstname" /> <e:inputtext entitybb="#{entitybb}" type="#{type}" property="submitterlastname" /> </h:panelgrid> <h:panelgrid styleclass="ronepanel" columns="1"> <h:panelgroup> <h:outputtext value="#{appmessages[type.concat('.address')]}" styleclass="fieldname" /> <h:panelgrid columns="3" cellpadding="2" cellspacing="0" styleclass="fieldcontent" columnclasses="raddressstreet, raddressstreetnr, raddressboxnr"> <h:panelgroup> <h:inputtext id="submitterstreetname" value="#{entitybb.entity.address.street}" required="true" styleclass="#{component.valid ? '' : 'addresserror'}" /> <rich:tooltip target="submitterstreetname"> <h:outputtext value="#{appmessages[type.concat('.submitterstreetname')]}" /> </rich:tooltip> </h:panelgroup> "2 other similar columns" (would make code complex problem) </h:panelgrid> </h:panelgroup> </h:panelgrid> </h:panelgroup> <a4j:commandbutton value="#{appmessages['general.action.save']}" actionlistener="#{entitybb.createstandardletter()}" render="generateletterform messages letterexistspanel" status="ajaxstatus" styleclass="floatright"/> </h:form>
edit: first 2 input text fields (e:inputtext) own components. nothing goes wrong there.
the backing bean viewscoped
when enter form value stored in attribute in viewscoped bean. when enter form incorrectly, 'process validations' phase throw error means 'update model values' phase not executed, value in viewscoped bean remains original 1 entered when entered form correctly , value redisplayed when view rendered.
Comments
Post a Comment