带有验证码的PrimeFaces向导 [英] PrimeFaces wizard with captcha
本文介绍了带有验证码的PrimeFaces向导的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在<p:wizard>
PrimeFaces中实现<p:captcha>
.我只发现了此张贴类似的问题,当在向导中的验证码会在无效输入时消失.提议的解决方案对我不起作用.
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.
主要问题:是否可以通过某些适当的方式将capcha插入PrimeFaces向导?
Main question: is possible insert capcha into PrimeFaces wizard by some propper way?
感谢您的答复!
推荐答案
我没有提出合适的解决方案(向导选项卡的AJAX更新阻止了Recaptcha控件的iframe重新加载),但是我创建了一个简单的解决方案解决方法:
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:
- 位置
<p:captcha>
- 绝对放置验证码iframe,以便它在向导中移动
- 使用CSS和 隐藏它
- 取消隐藏相应向导选项卡上
flowListener
方法内的验证码:
<p:wizard>
之外的- 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:
例如
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();
}
这篇关于带有验证码的PrimeFaces向导的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文