Hi Dave,
To Achieve this we can use either JQuery or Javascript, where we can disable right click on that particular image.
Please do refer this article
How to restrict right click on an image control in K2 Smart form
Regards,
Vijay
I attempted to get this to work but I must be missing something although the instructions are clear and simple. I looked at the tag for the image control I want to disable and it looks like this:
<label title="TestSig.JPG / (JPEG Image)" class="file-label" style="height: 72px;" for="3b426f*personal details removed*b-3d*personal details removed*c19-f657f7f6bba0_5f5005*personal details removed*d8-1e*personal details removed*c-c62b7c9d8117_file-inputId"> </label>
Since this isnt a typical img tag Im guessing I need to make changes to the script but im not sure what to change or if it will work in this situation.
Thanks for the help!
Dave
To work this, change your tag name from <label> to <img>
So your label tag
<label title="TestSig.JPG / (JPEG Image)" class="file-label" style="height: 72px;" for="3b426f*personal details removed*b-3d*personal details removed*c19-f657f7f6bba0_5f5005*personal details removed*d8-1e*personal details removed*c-c62b7c9d8117_file-inputId"> </label>
should be replaced with
<img title="TestSig.JPG / (JPEG Image)" class="file-label" style="height: 72px;" for="3b426f*personal details removed*b-3d*personal details removed*c19-f657f7f6bba0_5f5005*personal details removed*d8-1e*personal details removed*c-c62b7c9d8117_file-inputId"/>
In this case you dont have to replace jQuery provided by @VJay. (i.e. @ point 1 To disable right click on All Images on smartform. )
But in case if you want to proceed with label tag only then replace img tag name with label in jquery, hence your query should be
<script>
$('label').bind('contextmenu', function(e)
{
return false;
});
</script>
That should work for the specific image but I would like to make sure tat all images in that particular control are non-clickable. Is there a way to make it a wildcard?
No provided jquery will work for all images.
As in your case u are showing all images with label tag hence use below script which I have also mentioned in previous post.
This will disable right click for all images which are having tag label.
<script>
$('label').bind('contextmenu', function(e)
{
return false;
});
</script>
In case you are showing images with both img and label tag than u have to use some common attribute or attribute with wildcard selector in above jquery
or write the same jQuery with both label and img tag as mentioned below.
<script>
/**Below script will disable right click for all label tags**/
$('label').bind('contextmenu', function(e)
{
return false;
});
/**Below script will disable right click for all img tags**/
$('img').bind('contextmenu', function(e)
{
return false;
});
</script>
That worked perfectly for diabling right click context menu thanks!