JSF Terti ViewState
-
There's a form of registration and a fashion window where the user turns a drop, all in one HTML form. Problem is, once the page is updated, the button in the window only works second time.
I tried to take id form and rent it like this. http://balusc.omnifaces.org/2011/09/communication-in-jsf-20.html#AjaxRenderingOfContentWhichContainsAnotherForm Not working.
<h:form> <h:inputText value="#{Controller.email}" /> <h:inputText value="#{Controller.password}" /> <ui:fragment rendered="#{!(Controller.needValidateCaptcha) }"> <a4j:commandButton action="#{Controller.doRegistration}" value="Зарегистрироваться"> </a4j:commandButton> </ui:fragment> <ui:fragment rendered="#{(registrationController.needValidateCaptcha) }"> <button type="button" data-toggle="modal" data-target="#Captcha" action="$('#Captcha').modal('show');">Зарегистрироваться</button> </ui:fragment>
<!-- Попап -->
<div class="modal" id="Captcha">
<a4j:outputPanel id="Panel">
<div class="row">
<div class="col-md-6">
<h:inputText id="regcap" value="#{Controller.captcha}"/>
<ui:fragment rendered="#{Controller.captchaError}">
<h:outputText value="#{registrationController.captchaErrorMsg}" />
</ui:fragment>
</div>
</div>
</a4j:outputPanel>
<a4j:commandButton action="#{Controller.doRegistration}" value="Ok" render="registrationPanel">
</a4j:commandButton>
</div>
</h:form>
-
Try updating the form parent element. What you describe is a fairly common problem and https://stackoverflow.com/users/157882/balusc I wrote a hundred responses on this subject, for example. https://stackoverflow.com/questions/10094615/a4jcommandbutton-action-is-only-invoked-on-second-click