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
Paul Hughes
Hi Ifra Saqlain
No that didn't work for me, its not hiding homepage form or nesty form now. I'm conscious I've used a lot of your time now so thank you.
0
Ifra Saqlain
Paul once try this, remove all code which have shared above and add the below code:
// Hide the forms from Anonymous Users
$(document).ready(function () {
for (var c in HelpCenter.user.organizations) {
if(HelpCenter.user.organizations[c].name == "Students") {
if (HelpCenter.user.role=="anonymous") {
// Hide the graduation form from Homepage
if (window.location.href.indexOf("?ticket_form_id") > -1) {
console.log("yes!");
} else {
var _x = $(".list-group > a[href*='7446275690524']").remove();
}
}
//Code for some specific ticket forms -- Start
var tagsToRemove = ['7446275690524']; //special form ID
function removeTagsWeDontWant() {
$('.nesty-panel').on('DOMNodeInserted', function(e){
for(var i in tagsToRemove) {
$('li#' + tagsToRemove[i]).remove();
}
});
};
if (HelpCenter.user.role=="anonymous") {
removeTagsWeDontWant();
}
// End
}
}
});
0
Paul Hughes
Hi Ifra Saqlain and Pulkit Pandey
I have used both your code and it appears I'm getting closer to getting this working, so thank you both.
I had to create two sections of code, one above the other, all seems to be working, its hiding the forms from students and anonymous users on both the homepage and nesty.
The only issue I'm facing now is the form is showing on the homepage for staff users which is correct as I have not hidden it from staff users, but its hiding the form in the nesty panel for staff users, which is not correct.
This has something to do with Part 2 of the code, any ideas what this might be?
Part 1 - Hiding the Form on the homepage from Anonymous users/ Works perfect.
Part 2 - Hiding the Form from users with the oganisation name = Students
Together
0
Pulkit Pandey
Hi Paul H
Please, replace the previous code which I shared with the current one
Let me know if it solves your issue
Thank you
Pulkit
Team Diziana
0
Ifra Saqlain
Paul H
Copy the code and paste it and see homepage:
You have anchor tag in code in your inspect element tab:
See the anchot tag and it has form ID: 7446275690524
<a class="list-group-item list-group-item-action p-4" href="/hc/en-ie/requests/new?ticket_form_id=7446275690524">
This form ID 7446275690524 is your Digital Learning form. So your Digital Learning form will hide on homepage if this form organisation is Students else it won't hide.
You can copy this id and add it to your script code and then test.
Another way is,
tell the form's name with it's organizations which you wanna hide on homepage, so I'll share the right code as per your requirements.
0
Paul Hughes
Hi Pulkit Pandey
Thanks for the code, it works on the nesty panel thanks you but not on the forms i have located on my requests page.
The forms are just url in anchors that bring the user to the form nesty panel.
0
Paul Hughes
Hi Ifra Saqlain,
Thanks for all your help, as I'm using SSO I'm not able to get you access to our Zendesk portal, but thank you for the offer.
I don't see any from ID anchor tag in my console on homepage. If im looking in the wrong place maybe you could let me know.
0
Pulkit Pandey
Hi Paul H
Please, Add the below code at the bottom of your script.js file
Let me know if it solves your issue
Thank You
Pulkit
Team Diziana
0
Ifra Saqlain
Just go to the homepage of your forms and right click > inspect > select on any form > you will get the anchor tag.
Tell your all form name which you want to hide, I'll share the code then you need to add as it is.
Finally I'm thinking that send your HC credential on my personal mail id and tell exact query then I'll do that by myself at night after that you can change the password.
0
Paul Hughes
Hi Ifra Saqlain
I was never able to find the anchor tags, still stuck on the piece of hiding the forms from the homepage. Have you any other ideas of how I could achieve this?
Kindest,
Paul
0
Sign in to leave a comment.