- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2023 11:33 AM
Hi Guys,
We are trying to hide the option to Remove All and the Pen icon in the MRVS. I have the onChange script below. It works perfectly in the Portal but not on the classic UI.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2023 11:47 AM
Hi Jocelyn,
Try this line to hide the Remove All button in the classic UI:
document.getElementById(mrvsid + 'removeAllRows').style.display = 'none';
Here's the lines I've used to hide the row delete and edit buttons:
var mrvs = g_form.getValue(mrvsname);
var obj = JSON.parse(mrvs);
for (var i = 0; i < obj.length; i++) {
//delete - check Name, may be 'cross' instead
document.getElementsByClassName('btn-sm multi-row-delete-row')[i].style.display = 'none';
//edit
document.getElementsByClassName('btn icon-edit btn-sm')[i].style.display = 'none';
}
Inspect the elements to make sure those names are still correct, and ensure the Isolate script box remains unchecked. Also, I typically run this onLoad with a setTimeout to allow the MRVS to load as/after the form loads before the hiding is attempted, but if it's already loaded and onChange of whatever works for you then that's one less thing to worry about.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2023 11:47 AM
Hi Jocelyn,
Try this line to hide the Remove All button in the classic UI:
document.getElementById(mrvsid + 'removeAllRows').style.display = 'none';
Here's the lines I've used to hide the row delete and edit buttons:
var mrvs = g_form.getValue(mrvsname);
var obj = JSON.parse(mrvs);
for (var i = 0; i < obj.length; i++) {
//delete - check Name, may be 'cross' instead
document.getElementsByClassName('btn-sm multi-row-delete-row')[i].style.display = 'none';
//edit
document.getElementsByClassName('btn icon-edit btn-sm')[i].style.display = 'none';
}
Inspect the elements to make sure those names are still correct, and ensure the Isolate script box remains unchecked. Also, I typically run this onLoad with a setTimeout to allow the MRVS to load as/after the form loads before the hiding is attempted, but if it's already loaded and onChange of whatever works for you then that's one less thing to worry about.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2023 05:31 AM
Hi Brad!
I appreciate your time to reply to my email.
I am still working on it. It doesn't seem to work. I created a catalog item with just the MRVS and every time I populate the MRVS the 'Remove All' activates.
Thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2023 09:17 AM
So that means the code works to hide the button, just not when you expect it to, or every time you populate the MRVS the row immediately gets deleted? You have this script running against the Catalog Item, not the MRVS, and it is onChange of which variable - or when do you want it to run?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2023 12:15 PM
Ok, I was able to hide the "Remove All" button. I was missing the item sys ID:
document.getElementById(itemID + mrvsid + 'removeAllRows').style.display = 'none';
I still can't remove the edit (Pencil icon). The script runs even before the MRVS is populated and so the MRVS value is empty.