- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2020 01:23 AM
I Created a reference field and a check box in ui page
on load of the ui page the "reference field" is read only but though it is read only i can select the reference field value
how can i avoid that.
HTML:
<label style="margin-right:8px; font-size:12px;">User</label> <input type="checkbox" id="usercheckbox" /> $[SP]$[SP]
<g:ui_reference name="user" id="user" table="sys_user" />
client script:
gel("sys_display.user").readOnly=true;
usercheckbox.addEventListener("change", function() {
if (gel("usercheckbox").checked) {
gel("sys_display.user").readOnly=false;
}
else
{
gel("sys_display.user").readOnly=true;
}
});
Below is the image though its readonly i was able to select the search icon to select the user
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2020 01:51 AM
Hi,
You have to hide the look as well. So use this code as well:
gel("sys_display.user").readOnly=true;
document.getElementById('lookup.user').style.visibility="hidden";
So this will make field readonly and hide the reference icon.
Thanks,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2020 01:51 AM
Hi,
You have to hide the look as well. So use this code as well:
gel("sys_display.user").readOnly=true;
document.getElementById('lookup.user').style.visibility="hidden";
So this will make field readonly and hide the reference icon.
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2020 02:00 AM
Hi,
You can use below line to disable glass icon(anchor tag)
gel("lookup.user").style="pointer-events: none;"
Enable glass icon(anchor tag)
gel("lookup.user").style="";
Thanks.