I intend to verify a field usernameTxt
in form with bootstrap below, with a reference to BalusC answer and Aleksei Loginov answer
<div class="form-group">
<label class="control-label col-sm-2" for="usernameTxt">Fullname(*):</label>
<div class="col-sm-10">
<h:inputText type="text" class="form-control" id="usernameTxt"
a:placeholder="Enter your name" required="true"
requiredMessage="Fullname is required"
value="#{data.personalInformation.username}"></h:inputText>
<h:panelGroup layout="block" rendered="#{not empty facesContext.getMessageList('usernameTxt')}" class="alert alert-danger">
<h:message for="usernameTxt"></h:message>
</h:panelGroup>
</div>
</div>
The wish is that if the input text is empty then it will render the block <h:panelGroup>
, and the result should be like
(That photo is when I remove the not
condition in the rendered
property). I can't make the block rendered conditionally correctly. Is there any syntax in the render condition, or am I missing something here ?