Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Lock image field

Avatar

Level 7

Here is my scenario:

I have a Image field where users enter a Picture.

How I can lock the image field after entering the picture having before locking a alert message like:

"Image field will be lock. Are you sure is the correct picture?"

Also any suggestion how to unlock only the Image field of the form?

Thanks for your help

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

The locking and unlocking of objects is achieved using .access.

imageField1.access = "readOnly"; // locked

imagefield1.access = "open"; // unlocked

Now the imageField has the inbuilt clickability for adding images to the object. You could try the following in the click event of the imageField, but you may need to move it around to a different event - it just depends on when the image is loaded.

var nButton = app.alert({

     cMsg: "Warning: You are about to lock this image. \n\nAre you sure that this is the correct image?",

     cTitle: "Uploading images",

     nIcon: 1, nType: 2

});


if (nButton == 4)

{

     this.access = "readOnly";

}

else

{

     this.access = "open";

}

The response from the app.alert is assigned to the nButton variable and then the if statement is checking which button the user selected in the dialogue - 'Yes' or 'No'.

Hope that helps,

Niall

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi,

The locking and unlocking of objects is achieved using .access.

imageField1.access = "readOnly"; // locked

imagefield1.access = "open"; // unlocked

Now the imageField has the inbuilt clickability for adding images to the object. You could try the following in the click event of the imageField, but you may need to move it around to a different event - it just depends on when the image is loaded.

var nButton = app.alert({

     cMsg: "Warning: You are about to lock this image. \n\nAre you sure that this is the correct image?",

     cTitle: "Uploading images",

     nIcon: 1, nType: 2

});


if (nButton == 4)

{

     this.access = "readOnly";

}

else

{

     this.access = "open";

}

The response from the app.alert is assigned to the nButton variable and then the if statement is checking which button the user selected in the dialogue - 'Yes' or 'No'.

Hope that helps,

Niall