1 Reply Latest reply on Jul 25, 2008 4:43 PM by Damian Harvey

    How to save a picture address on a click on it.

    alex sneider Newbie
      Hi everyone.

      The simplified situation looks like this: I have a picture in a page. The user clicks on it, and I have to store it's address. For example: <h:graphicImage value="img/pic01.jpg"> </h:graphicImage> and I need to store somewhere, in a context variable or something, the value: "img/pic01.jpg", in order to access it later in the page. How can I do that?

      Thank you.
        • 1. Re: How to save a picture address on a click on it.
          Damian Harvey Apprentice

          You could do something like:

          <h:graphicImage url="img/pic01.jpg" onclick="storePicture(this.src);"/>
          <h:graphicImage url="img/pic02.jpg" onclick="storePicture(this.src);"/>
          <a4j:jsFunction name="storePicture" action="#{storePictureBean.store}">
              <a:actionparam name="param1" assignTo="#{storePictureBean.src}"/>

          And then handle adding the src to whatever context you want in the Bean.