Hiding a ticket form on the 'submit a request' page
Answered
Posted Aug 12, 2021
Hi!
I need to know how to hide a form from the 'submit a request' page drop down option, we don't want customers able to select it from the list (we are currently doing a trial by sending them a hyperlink to it through email contact). Customers are not required to sign in to submit a form so we can't use the option of hiding dependant on organisation (saw an article recommending this).
Does anyone know how I can do this please? Newbie coder here so not sure how to go around doing this!
2
100
100 comments
Antoine STOENESCU
Hello Eric, same for me. Worked fine until now, but now it's not working anymore. That's my code :
I personally use a theme from Lotus, I'll also message them just in case.
var tagsToRemove = ['XXXX'];
function removeTagsWeDontWant() {
$('.nesty-panel').on('DOMNodeInserted', function(e){
for(var i in tagsToRemove) {
$('li#' + tagsToRemove[i]).remove();
}
});
};
removeTagsWeDontWant();
Thank you.
0
Sierra Collins
Hello, I learned that Chrome released an update on 7/23/24, where mutation event 'DomNodeInserted' is no longer supported by Chrome. This has caused an issue with this set up in our instance and now a client can see a form that was originally hidden from them.
Is there an updated script we should use in this case?
Reference Link: https://developer.chrome.com/blog/mutation-events-deprecation
Here is the current script we have and was working originally:
<script>
// Generic function to remove form option from form selection dropdown
function removeFormOption(formID) {
$('#request_issue_type_select option[value="' + formID + '"]').remove();
$('.nesty-panel').on('DOMNodeInserted', function(e) {
$(this).children('ul').children().remove('#' + formID);
});
}
1
Ifra Saqlain
Hi Eric,
Give me some time, I'll get back to you soon.
Thanks
0
Eric Norris
Hi Ifra,
I've used your original code for some time now and it worked great. For some reason, today it stopped working in Chrome. Not sure why this is happening as the only changes we made were to add tags as we go, and haven't done that in recent memory. Do you have any ideas? Thanks
Code using for reference:
$(document).ready(function()
{
var tagsToRemove = ['XXXXXX','YYYYYY'];
removeTagsWeDontWant();
function removeTagsWeDontWant()
{
$('.nesty-panel').on('DOMNodeInserted', function(e)
{
for(var i in tagsToRemove)
{
$('li#' + tagsToRemove[i]).remove();
}
});
}
2
Ifra Saqlain
Hi Ester,
use the given code:
If any issues feel free to ask :)
Thanks
1
Ifra Saqlain
Hi Gavin,
I have read your query.
Closing brackets are missing at the end of code, please add the brackets and then still you get the same issue please let me know.
Thanks
0
Gavin
Ifra Saqlain
I have been able to hide a ticket from from the drop-down selector using the following code...
HOWEVER - this is now generating a "deprecated" error in the Chrome browser console...
I see the recommendation is to use MutationObserver instead, however I'm not skilled enough to implement this on my own. Do you have updated recommended code to hide a form?
0
Hannah Lucid
Ifra Saqlain that worked. You are AWESOME.
0
Ifra Saqlain
Hi Hannah Lucid :)
Your form tiles have a unique id in the code:
So, pick a class-name which tile you wanna hide as I'm selecting second form:
Copy the class name of second form tile:
seconf form-tile class-name : id-1260813066549
Now, go to the source files and add CSS code to your style.css file at the bottom, your form title will be hide
Any form tile you wanna hide, just pick the class-name and hide via CSS as I did above.
Or, If you wanna hide your tile from specific users so you can do like this:
Go to your script.js file and add the given code at the bottom area.
If any confusion feel free to ask :)
Thanks
2
Hannah Lucid
Ifra Saqlain Saqlain, is there a way to hide a form tile in the Guide? I tried using the coding above and was not able to remove this from our support portal:
https://rpmtest.zendesk.com/hc/en-us
0
Sign in to leave a comment.