Results 1 to 3 of 3

Thread: How to refresh image alone in a portlet upon clicking some button

  1. #1
    Join Date
    Aug 2008
    Posts
    109

    Default How to refresh image alone in a portlet upon clicking some button

    In my registration page, i've implemneted JCaptcha. The problem is sometimes it's very difficult to read the image. So, we are planning to provide a button named 'REFRESH' next to the jcaptcha image and upon clicking REFRESH button, it has to refresh only the jcaptcha image not the entire page/portlet. How can we do that?

    Currently i'm doing this way in my jsp:

    Code:
    <td><img id="siimage" src="/spring-portlet-sample/jcaptcha" alt="Dynamic Verification Code" border="5" >
                                                 <a  style="border-style: none" href="#" title="Refresh Image" onclick='document.getElementById("siimage").src="/spring-portlet-sample/jcaptcha"; return false;'><img src="/jetspeed/decorations/portlet/jetspeed/images/refresh.gif" alt="Reload Image" onclick="this.blur();"  border="0" align="bottom" /></a>
                                                 </td>
    IN the image url, jcaptcha is a servlet.

    If anybody know the solution, please share.

    Thank you.

  2. #2
    Join Date
    Oct 2006
    Posts
    228

    Default

    Code:
    <a  style="border-style: none" href="#" title="Refresh Image" onclick='document.getElementById("siimage").src="/spring-portlet-sample/jcaptcha"; return false;'><img src="/jetspeed/decorations/portlet/jetspeed/images/refresh.gif" alt="Reload Image" onclick="this.blur();"  border="0" align="bottom" /></a>
    I think you are pretty close already. You probably just need to add something like a # + a randomly generated number onto the end of the update image source to avoid caching.

    e.g. /spring-portket-sample/jcaptcha#987938279

  3. #3
    Join Date
    Aug 2008
    Posts
    109

    Default

    Thanks Chris. Yes .... by adding a randomly generated number, i could able to ahieve what i wanted.

    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •