Announcement Announcement Module
Collapse
No announcement yet.
How to refresh image alone in a portlet upon clicking some button Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


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

      Thanks again.

      Comment

      Working...
      X