PrimeFaces wizard with captcha

南楼画角 提交于 2019-12-25 06:16:11

问题


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:

  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:

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!