This article describes how to restrict right click on an image control in K2 Smart form at run time.
Let’s walk through a small example where I have disabled right click on image. Here I have used both image tag and image id as selector to disable the right click.
Image tag will allow us to disable right click on all the images, while Image id will disable right click on a particular image.
Step1: In Your SmartForm Drag and Drop Data Label and Set Literal property as checked.
Step2: Set visible property to False.
Step3: Now Under Expression property add below Script
- To disable right click on All Images on smart form.
- To disable right click of a particular image on smart form
Use below sample query to disable right click for particular image.
To get “Image CSS selector path” refer below steps.
Access Your Smart form in web page at runtime mode.
Now access developer options in browser (hit F12), select inspect button and then click on image. Which will show you id as below highlighted.
Copy that id and replace in the above script text “Image css selector path”.
Now copy this script and add it to expressions property.
Step 4: Once you are done with Changes Save you smart form and access in run time mode.