问题
I am trying implement <p:captcha>
into <p:wizard>
PrimeFaces. I found only this post with similar problem, when capcha in a wizard will disappear on invalid input. The proposed solution doesn't work for me.
Main question: is possible insert capcha into PrimeFaces wizard by some propper way?
Thanks for any replies!
回答1:
I didn't come up with a proper solution (the AJAX update of wizard tabs prevents the iframe of the Recaptcha control to be reloaded) but I created a simple workaround:
- position
<p:captcha>
outside of the<p:wizard>
- position the captcha iframe absolutely, so it gets moved inside the wizard
- hide it with CSS and
- unhide the captcha inside the
flowListener
method on the appropriate wizard tab:
e.g.
public String onFlowProcess(FlowEvent event) {
RequestContext context = RequestContext.getCurrentInstance();
if ("confirm".equals(event.getNewStep())) {
context.execute("jQuery(document.getElementById('register:captchaDiv')).show()");
} else {
context.execute("jQuery(document.getElementById('register:captchaDiv')).hide()");
}
return event.getNewStep();
}
来源:https://stackoverflow.com/questions/16419220/primefaces-wizard-with-captcha