Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Assign image

Questions related to using nuBuilder Forte.
Locked
Timo
Posts: 217
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

Assign image

Unread post by Timo »

My requirement is to load a different image to an Object of Type Image when a form is opened.
I thought I could to this by JavaScript and tried

Code: Select all

nuAttachImage('logo', 'imgProject1'); 
but the image is not changed.

Code: Select all


if (nuFormType() == 'edit') {

 switch (project) {
    case 'project1':
        img = "imgProject1";
        break;
    case 'project2':
        img = "imgProject2";
        break;
    case 'project3':
        img = "imgProject3";
        break;
    }

nuAttachImage('logo', img);  ----> not working!

}
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Assign image

Unread post by admin »

Timo,

Do you have a div with an id of logo?

Steven
Timo
Posts: 217
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

Re: Assign image

Unread post by Timo »

No, I use the Tab - Image of an Object of Type Image
The Image Object is an easy way to display a specific image stored in nuBuilder Files.
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Assign image

Unread post by toms »

Hi,

Change the Type of your object to HTML and nuAttachImage() will work.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Assign image

Unread post by admin »

.
Timo
Posts: 217
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

Re: Assign image

Unread post by Timo »

thank you, works
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Assign image

Unread post by admin »

.
Locked