This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Feb 25, 2011, 10:44 AM
16 Posts

Set image resource URL within a repeat control

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: repeat,image resource,ssjs
  • Replies: 3
I have an image resource within a repeat control
 
In my SSJS on the click event of the image resource (which does a full update), I want to amend the URL - if I use getComopnent("imageResource1").setUrl("/Ok.gif"), it works, but it sets the image to ALL the image resources within the repeat control rather than just the target one 
 
Any suggestions? 
Feb 25, 2011, 10:44 AM
149 Posts
Re: Set image resource URL within a repeat control
 
I think this is the way it works in a repeat if you do a full update.
not sure, but you might try and use getClientID instead of getComponent
 
Thomas
Feb 25, 2011, 11:22 AM
9 Posts
Re: Set image resource URL within a repeat control
One way to do this is to set a sessionScope variable when you click your button. Then in the repeat control check the value to see if you need to put an OK or another image up.
 
 
Feb 25, 2011, 11:45 AM
261 Posts
Re: Set image resource URL within a repeat control
  • Add a hidden input field to your page (xp:inputHidden) and bind it to the viewScope variable "selectedImage", set the ID of the control to "selectedImage".
  • In the onClick event of the image in the repeat, add a client Javascript expression that fills the editable field with a unique identifier for the image clicked (in the example code: it's the repeat control variable imageId):
    • dojo.query('[id$="selectedImage"]')[0].value = '#{javascript:imageId;}'
  • In the property that computes the image to be shown (inside the repeat), check if the image was selected by reading the selectedImage viewScope variable: show the "ok.gif" image if it is or the default image if it isn't.

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal