带有验证码的PrimeFaces向导 [英] PrimeFaces wizard with captcha

查看:187
本文介绍了带有验证码的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:wizard> 之外的
  1. 位置<p:captcha>
  2. 绝对放置验证码iframe,以便它在向导中移动
  3. 使用CSS和
  4. 隐藏它
  5. 取消隐藏相应向导选项卡上flowListener方法内的验证码:
  1. position <p:captcha> outside of the <p:wizard>
  2. position the captcha iframe absolutely, so it gets moved inside the wizard
  3. hide it with CSS and
  4. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆