I have to validate that a h:inputText has a value. There for I'm using the required="true" on that component. It does the job and it works, but then something strange happens.
When I leave it blank, the required="true" happens. When I type some text in the inputText, the required="true" does not happen. When I, after adding text, remove the text the required="true" happens, but the previously entered value reappears in the inputText.
I don't really have got an idea what this could be. Note that when I'm saying the "required="true"" happens, I mean that the border of the inputText gets red (see code).
Here is the 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 to complex for the 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: The first 2 input text fields (e:inputText) are my own components. Nothing goes wrong there.
The backing bean is ViewScoped