PrimeFaces wizard with captcha

I am trying to implement <p:captcha> in <p:wizard> PrimeFaces. I found only this post with a similar problem, when the capcha in the wizard disappears if it is entered incorrectly. The proposed solution does not work for me.

The main question is: can I insert capcha into the PrimeFaces wizard in some way?

Thanks for any answers!

0
source share
1 answer

I did not come up with the right solution (updating the AJAX tabs of the wizard prevents the iframe of the Recaptcha control from reloading), but I created a simple way:

  • position <p:captcha> outside <p:wizard>
  • position the captcha iframe absolutely, so it moves inside the wizard
  • hide it with CSS and
  • display the captcha inside the flowListener method on the corresponding wizard tab:

eg.

 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(); } 
+1
source

Source: https://habr.com/ru/post/1479721/


All Articles