Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to refresh captcha text with JS or render?

kashifayyazNov 5 2012 — edited Nov 5 2012
I am using simpleCaptcha library to display captcha using servlet. requirement is to refresh the captcha if refresh button is pressed.

I have tried with render facility as well as using javascript but nothing is working on my end. following is my code for refresh button, captcha display and javascript function.

<h:graphicImage value="/img/refresh-s.png" onclick="changeCaptcha()" />

<f:verbatim>
<img id="myCaptcha" src="/RoyalCourtPortal-portlet/simpleImg" width="120" height="30" />
</f:verbatim>


function changeCaptcha(){
$('myCaptcha').attr('src', '/RoyalCourtPortal-portlet/simpleImg' );
}

/////////////////////////////////////////////////////////////////////////////////////////
Please while answering provide code example as I am very new with javascirpt.


Thanks in advance

regards
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 3 2012
Added on Nov 5 2012
1 comment
639 views