[HELP] Dynamically change form image value not working


#1

I create a form and I added {type: 'image'} control to it.

I want to change the photo of that control whenever the user selects a record/entry on grid.
How to do that?

I tried this code but not working.

 form.clear(); // I want to clear existing photo first.
 form.setItemValue("profile_photo", "imglink_example-user1-img.png");

The above script is not working. The image control is not displaying the dynamically set ItemValue.
How to do that?

I want the photo control to load/show a photo when the user selects an entry on the grid.

HELP.


#2

I apologize for the delay with the reply.
Pleas,e try to load a new image to a form with some time out afte rthe form clearing:

        form.clear();
        setTimeout(function(){
            form.setItemValue("profile_photo", "imglink_example-user1-img.png");
        },50)

or just avoid calling the clear() method (if it is a situation in your case), as it will replace the icon without its calling.