How to remove update/delete from referenced image field?

richv
Kilo Explorer

Hello!

We have an issue with a custom app form which contains a referenced image field from another table. The User is seeing Update/Delete options on the image, and wrongly assumes that they apply to simply removing the image from the form, whereas of course deleting is removing the image from its own table.

We wish to remove the update/delete availability from the image when viewed as a reference. We cannot do this through ACLs, as the role in question must be able to achieve these functions when accessing the image in its native table, it is just we wish to restrict them from doing it here. Setting the field as read-only obviously will affect the native table as it is a reference, so is also not an option. We have attempted UI policies and client scripts which work fine on non-referenced fields, but will not work on the referenced image. Currently using Dublin version.

Any suggestions greatly appreciated,

Thanks,

Richard

1 ACCEPTED SOLUTION

Okay, try this.   'u_observation' is the table that you want to hide the links from, 'u_plan' is the name of the reference field on that table, and 'u_plan_image' is the name of the image field on the referenced table.



$('edit.u_observation.u_plan.u_plan_image').hide();




If this doesn't work, you can right-click the links in your browser and use a dom inspector to find out what the ID is.   This works in Fuji but may be slightly different in Eureka and Dublin.


View solution in original post

5 REPLIES 5

Mark Stanger
Giga Sage

How about this in an onLoad client script?



$('edit.incident.u_citm.icon').hide();



Just change 'incident' to the name of the table that the client script is running on and 'u_citm' to the name of the reference field you've created.


richv
Kilo Explorer

Hi Mark,



Thanks for your suggestion.



I tried the script:



$('edit.u_observation.u_plan.icon').hide();



where u_observation is the local table name - the form on which the reference image field is sitting, and u_plan is the reference field's name on its own table (u_location).



But unfortunately it had no affect on the ability for a user to update/delete the image through the reference image. I also tried changing the table name to the name of the reference field as well - so edit.u_location.u_plan.icon, but this also had no effect.



find_real_file.png


Just to explain, the plan field on the left is a local field on this table (u_observation), referencing to the u_location table. The Plan Image on the right is an image reference field pointing directly into the u_location table, and not existing in the local table. (image may have moved off screen to right above, click on image to see full)



Here is the dictionary entry for Plan Image:


find_real_file.png


Target, as stated, is to remove the update/delete availability when viewed from this form in u_observation (without impacting behaviour on home table)




Thanks,



Richard


Okay, try this.   'u_observation' is the table that you want to hide the links from, 'u_plan' is the name of the reference field on that table, and 'u_plan_image' is the name of the image field on the referenced table.



$('edit.u_observation.u_plan.u_plan_image').hide();




If this doesn't work, you can right-click the links in your browser and use a dom inspector to find out what the ID is.   This works in Fuji but may be slightly different in Eureka and Dublin.


Thats the one!



$('edit.u_observation.u_location_name.u_plan').hide();



right clicking and inspecting element on the referenced field gave its full name, then it worked perfectly. Thanks for the help!