Setting image source at runtime

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

User avatar
Andy McMaster
Ebase User
Posts: 33
Joined: Fri Feb 29, 2008 12:08 pm
Location: Newcastle upon Tyne
Contact:

Setting image source at runtime

#1

Postby Andy McMaster » Fri Nov 04, 2011 2:15 pm

Hi,

I have a component which has a table, one column of which is a button.

Is there anyway I can change at runtime the image that is displayed? The URL currently points to: /ebasecontent/images/image1.gif

I want to be able to change that in certain circumstances when the form is initialised?

Thanks in advance.

Andy
0 x
<b>Do not despise the snake for having no horns for who is to say it will not become a dragon</b>

Vircos
Ebase User
Posts: 97
Joined: Thu Sep 13, 2007 6:07 am
Location: The Netherlands

#2

Postby Vircos » Mon Nov 07, 2011 9:38 am

According to the Ebase documentation:

Code: Select all

set BUTTONCOLUMN1.buttonProperties.backgroundImage = 'urlToImage';
For more information:
http://dev-docs.verj.io/ufs/doc/Button_ ... c279134886
http://dev-docs.verj.io/ufs/doc/Styling ... ground.htm
Last edited by Vircos on Mon Nov 07, 2011 9:40 am, edited 1 time in total.
0 x
What's the meaning of Justice...

User avatar
Andy McMaster
Ebase User
Posts: 33
Joined: Fri Feb 29, 2008 12:08 pm
Location: Newcastle upon Tyne
Contact:

#3

Postby Andy McMaster » Mon Nov 07, 2011 9:40 am

Vircos wrote:According to the Ebase documentation:

Code: Select all

set BUTTONCOLUMN1.buttonProperties.backgroundImage = 'urlToImage';
I shall try that later. Thanks.

Can you point me to where that was in the documentation please?

And is this version dependant?

Andy
0 x
<b>Do not despise the snake for having no horns for who is to say it will not become a dragon</b>

Vircos
Ebase User
Posts: 97
Joined: Thu Sep 13, 2007 6:07 am
Location: The Netherlands

#4

Postby Vircos » Mon Nov 07, 2011 9:41 am

See URL's in my first reply.
This works in Ebase v4.
0 x
What's the meaning of Justice...

User avatar
Andy McMaster
Ebase User
Posts: 33
Joined: Fri Feb 29, 2008 12:08 pm
Location: Newcastle upon Tyne
Contact:

#5

Postby Andy McMaster » Mon Nov 07, 2011 9:43 am

Vircos wrote:See URL's in my first reply.
This works in Ebase v4.
'Fraid we're on 3.4...

Sorry, didn't spot URLs in original post :) Too quick off the mark...
0 x
<b>Do not despise the snake for having no horns for who is to say it will not become a dragon</b>

Vircos
Ebase User
Posts: 97
Joined: Thu Sep 13, 2007 6:07 am
Location: The Netherlands

#6

Postby Vircos » Mon Nov 07, 2011 9:53 am

Perhaps you can try using a hyperlink fieldtype in combination with HTML presentation (properties of Fieldcolumn - Presentation) instead of a buttoncolumn. Apply a "On Click" event to start the specific FPL-script.

As a default value you can use a Ebase field containing the URL to image as (for example &&PATHTOIMAGE).

In your FPL you get something like this:

Code: Select all

set PATHTOIMAGE = '<img src="/ebasecontent/images/image2.gif" alt="image2" style="border&#58; 0;" />';
In this case you need to overide the CSS to remove the blue hyperlink border arround the image.

I hope my example is understandable.
0 x
What's the meaning of Justice...

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#7

Postby Jon » Thu Nov 17, 2011 11:31 am

In V3.4 you can do this (I think) by setting the URL for the image in the designer to be a && field variable e.g. &&IMAGELOC or possibly /ebasecontent/images/&&{IMAGELOC}.

Then set IMAGELOC at runtime.
0 x


Who is online

Users browsing this forum: No registered users and 122 guests