Primefaces Captcha消失或无效更新/刷新无效输入? [英] Primefaces Captcha disappears or doesn't update/refresh on invalid input?

查看:344
本文介绍了Primefaces Captcha消失或无效更新/刷新无效输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 h里面有以下代码:表格

<h:panelGrid id="captchaGrid">
    <p:captcha id="captcha" label="Captcha" required="true"
        requiredMessage="required"
        validatorMessage="...">
    </p:captcha>
    <p:message id="captchaMessage" for="captcha" />
</h:panelGrid>

<p:commandButton id="submitButton" value="save"
    actionListener="#{userBean.save}" update="captchaGrid"
    onstart="doSomething()"
    oncomplete="doSomethingElse(xhr, status, args)" icon="ui-icon-check">
</p:commandButton>

如果我正确输入验证码,这样可以正常工作。但是,如果我输入的值无效,验证码组件就会消失。

This works fine if I enter the captcha correctly. However, if I enter an invalid value, the captcha component just disappears.

我尝试删除 update =captchaGrid属性。这一次,验证码并没有消失。相反,它没有在视觉上刷新,但(我猜)在内部。因为正确输入两个单词仍会产生验证错误。

I tried removing the update="captchaGrid" attribute. This time, the captcha didn't disappear. Instead, it didn't refresh visually but (I guess) internally. Because typing the two words correctly still generates a validation error.

此外;我不想使用 ajax =false

更新:我也试过 oncomplete =Recaptcha.reload()。没工作。有一个错误。但我不知道这是我的代码还是Primefaces 3.0:)

Update: I also tried oncomplete="Recaptcha.reload()". Didn't work. There is a bug. But I don't know if it's my code or Primefaces 3.0 :)

更新2:正如maple_shaft所指出的,事实证明这是是Primefaces / Recaptcha的一个问题。所以我正在寻找你可能建议的任何脏黑客。

Update 2: As maple_shaft pointed out, it turns out that this is a problem with Primefaces/Recaptcha. So I'm looking for any dirty hacks you might suggest.

任何帮助表示感谢。

推荐答案

你不会喜欢我的答案,但这不是错误。

You are not going to like my answer, but this is not a bug.

Primefaces Issue 1642 被标记为无法修复。

Primefaces Captcha利用Recaptcha,它不支持和不支持Ajax刷新。您必须执行整页回发才能使此组件正常工作。请记住,这也会影响在需要面板的Ajax刷新的组件中使用Captcha的能力,例如标签视图或向导组件。

The Primefaces Captcha utilizes Recaptcha, which does not and cannot support Ajax refresh. You must do a full page postback for this component to work properly. Keep in mind this also affects the ability to use the Captcha in components that require Ajax refresh of a panel, such as a Tab View or Wizard component.

编辑另一方面,可以在< iframe> 中使用验证码组件来实现类似的效果,但这似乎是一个肮脏的黑客攻击。对不起,我无法提供更多帮助。

On another note, it might be possible to use the captcha component within an <iframe> to achieve a similar effect, but that seems like a dirty hack. Sorry I couldn't be more of a help.

这篇关于Primefaces Captcha消失或无效更新/刷新无效输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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