You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alec Swan <al...@gmail.com> on 2011/07/19 05:07:27 UTC

Refreshing captcha image

Hello,

We have a form with some required fields and a captcha image with
CaptchaImageResource. Everything works great, but the default Wicket
captcha component displays text which is hard to read for end-users. I
added an AjaxSubmitLink("reCaptcha") button which should allow the
user to re-generate the captcha image.

However, the image does not get refreshed. The code is shown below. Is
there a problem with the code or some recommended way to allow the
end-user to regenerate captcha text?

@Override
                protected void onSubmit(AjaxRequestTarget target,
Form<?> form) {
             password = "blah1";//newPassword();
            CaptchaImageResource captchaImageResource = new
CaptchaImageResource(password);
            NonCachingImage imgCaptcha = new
NonCachingImage("captchaImage", captchaImageResource);
            imgCaptcha.setOutputMarkupId(true); // required for AjaxFallbackLink
            addOrReplace(imgCaptcha);
            if (target != null) {
                target.addComponent(imgCaptcha);
            }
}

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Refreshing captcha image

Posted by Alec Swan <al...@gmail.com>.
That worked. Thank you Vineet!

On Tue, Jul 19, 2011 at 2:17 AM, vineet semwal
<vi...@gmail.com> wrote:
> use ajaxlink instead of ajaxsubmitlink ..
>
> On Tue, Jul 19, 2011 at 8:37 AM, Alec Swan <al...@gmail.com> wrote:
>> Hello,
>>
>> We have a form with some required fields and a captcha image with
>> CaptchaImageResource. Everything works great, but the default Wicket
>> captcha component displays text which is hard to read for end-users. I
>> added an AjaxSubmitLink("reCaptcha") button which should allow the
>> user to re-generate the captcha image.
>>
>> However, the image does not get refreshed. The code is shown below. Is
>> there a problem with the code or some recommended way to allow the
>> end-user to regenerate captcha text?
>>
>> @Override
>>                protected void onSubmit(AjaxRequestTarget target,
>> Form<?> form) {
>>             password = "blah1";//newPassword();
>>            CaptchaImageResource captchaImageResource = new
>> CaptchaImageResource(password);
>>            NonCachingImage imgCaptcha = new
>> NonCachingImage("captchaImage", captchaImageResource);
>>            imgCaptcha.setOutputMarkupId(true); // required for AjaxFallbackLink
>>            addOrReplace(imgCaptcha);
>>            if (target != null) {
>>                target.addComponent(imgCaptcha);
>>            }
>> }
>>
>> Thanks
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>
> --
> thank you,
>
> regards,
> Vineet Semwal
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Refreshing captcha image

Posted by vineet semwal <vi...@gmail.com>.
use ajaxlink instead of ajaxsubmitlink ..

On Tue, Jul 19, 2011 at 8:37 AM, Alec Swan <al...@gmail.com> wrote:
> Hello,
>
> We have a form with some required fields and a captcha image with
> CaptchaImageResource. Everything works great, but the default Wicket
> captcha component displays text which is hard to read for end-users. I
> added an AjaxSubmitLink("reCaptcha") button which should allow the
> user to re-generate the captcha image.
>
> However, the image does not get refreshed. The code is shown below. Is
> there a problem with the code or some recommended way to allow the
> end-user to regenerate captcha text?
>
> @Override
>                protected void onSubmit(AjaxRequestTarget target,
> Form<?> form) {
>             password = "blah1";//newPassword();
>            CaptchaImageResource captchaImageResource = new
> CaptchaImageResource(password);
>            NonCachingImage imgCaptcha = new
> NonCachingImage("captchaImage", captchaImageResource);
>            imgCaptcha.setOutputMarkupId(true); // required for AjaxFallbackLink
>            addOrReplace(imgCaptcha);
>            if (target != null) {
>                target.addComponent(imgCaptcha);
>            }
> }
>
> Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
thank you,

regards,
Vineet Semwal

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org