Take the 2-minute tour ×  I have a short question that has been
bothering for last few hours:  How can I execute a javascript
function before message that a value is required is shown? (on
form submit some value inside of it is empty when it needs to be
entere).  I have faced this problem while using RealPerson
captcha plugin for jQuery in my jsp page. When I click on submit
button with input field for captcha empty, the captcha
disappears.  Update 1:  I tried with binding and rendered but
the problem still seems to be there.  <h:outputLabel
for="captcha" value="#{ui.pleaseEnterTextInTheImage}"
rendered="#{sessionBean.showCaptcha}"/> <h:panelGroup
rendered="#{sessionBean.showCaptcha}">      <h:inputText
id="captcha" styleClass="captcha" binding="#{captcha}"
validator="#{validationBean.captchaValidator}" required="true"/>
<h:outputText value=" "/><h:message for="captcha"
styleClass="captchaMsg"/> <h:panelGroup
rendered="#{!captcha.valid}">      <script