Here is some code that I think will help
remove(image);
imagePass = randomString(6, 8);
captchaImageResource = new
CaptchaImageResource(imagePass);
image = new Image("captchaImage",
captchaImageResource);
add(image);
you can have it inside your onClick(AjaxRequestTarget target) {}
the key point to note is that you have to remove it first from the
component.
Regards
Kimotho.
On Wed, Jun 9, 2010 at 11:14 AM, Josh Kamau <[email protected]> wrote:
> Hi team;
>
> I am trying to regenerate a captcha to help users incase the previous one
> was not very clear. I have tried several things including the code below
>
> captchaImg = new CaptchaImageResource();
> captcha = new Image("captchaImg", captchaImg);
> captcha.setOutputMarkupId(true);
> frmRegistration.add(captcha);
> frmRegistration.setOutputMarkupId(true);
> IndicatingAjaxFallbackLink<String> lnkTryNewCapcha = new
> IndicatingAjaxFallbackLink<String>("lnkTryNewCapcha") {
>
> @Override
> public void onClick(AjaxRequestTarget target) {
> captchaImg = new CaptchaImageResource();
> captcha.setOutputMarkupId(true);
> captcha.render();
> }
> };
> frmRegistration.add(lnkTryNewCapcha);
>
> However i am not successful. Which is the best way to do this.
>
> Regards.
> Josh.
>