Page 1 of 1

Assign image

Posted: Fri Apr 27, 2018 6:55 am
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!

}

Re: Assign image

Posted: Fri Apr 27, 2018 7:38 am
by admin
Timo,

Do you have a div with an id of logo?

Steven

Re: Assign image

Posted: Fri Apr 27, 2018 8:25 am
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.

Re: Assign image

Posted: Sat Apr 28, 2018 7:24 am
by toms
Hi,

Change the Type of your object to HTML and nuAttachImage() will work.

Re: Assign image

Posted: Mon Apr 30, 2018 12:04 am
by admin
.

Re: Assign image

Posted: Mon Apr 30, 2018 6:16 am
by Timo
thank you, works

Re: Assign image

Posted: Tue May 01, 2018 1:19 am
by admin
.