- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2022 10:24 PM
Hi folks,
I tried using DOM manipulation to hide "Remove all" and "Remove Row" from MRVS, but unfortunately, it didn't worked out. Went through few codes across community but no luck.
Here's my code:
For "Remove all"
function onLoad() {
//Type appropriate comment here, and begin script below
//Hide Remove All button on MRVS
var btn = this.document.getElementsByClassName("btn btn-default");
for (i = 0; i < btn.length; i++) {
if (btn[i].innerText == 'Remove All') {
btn[i].style.display = 'None';
}
}
}
For Remove Row:
function onLoad() {
//Hide each X (delete row) icon on MRVS
var icon = this.document.getElementsByClassName("wrapper-xs fa fa-close");
for (j = 0; j < icon.length; j++) {
if (icon[j].getAttribute("title") == 'Remove Row') {
icon[j].style.display = 'None';
}
}
}
Can you please help me out ? Wondering what I'm missing here. As, I'm still able to see those two icons on my SP.
Thanks
Cheers,
RJ
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2022 03:49 PM
Yes! did tried those steps but no luck whatsoever.
Anyway, in the above code I've changed it a bit and now "Remove Row" button is hidden on MRVS.
function onLoad() {
setTimeout(function() {
disableButtons();
}, 500);
}
function disableButtons() {
var my_var = g_form.getField("mvrs_internal_name");
var icon = this.document.getElementsByClassName("wrapper-xs fa fa-close");
for (i = 0; i < icon.length; i++) {
//alert(icon[i].getAttribute("data-original-title"));
if (icon[i].getAttribute("data-original-title") == 'Remove Row') {
icon[i].style.display = 'None';
}
}
}
So, in if condition I've replaced existing condition with :
if (icon[i].getAttribute("data-original-title") == 'Remove Row')
And, eventually, that button/Remove Row is hidden on MRVS.
Cheers,
RJ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2022 03:57 PM
And, used this code for hiding "Remove all", working impeccable for me:
function onLoad() {
setTimeout(function() {
disableButtons();
}, 500);
}
function disableButtons() {
var vs = g_form.getField("variable_set_internal_name");
vs.max_rows_size = 0;
var btn = this.document.getElementsByClassName("btn btn-default");
for (i = 0; i < btn.length; i++) {
if(btn[i].innerText == 'Remove All') {
btn[i].disabled="disabled";
}
}
}