Recent searches
No recent searches
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
99
99 comments
Ifra Saqlain
Hey Paul, I think I'm too late :).
I found something for your query, check the organization name:-
Try this and let me know if it works.
Thanks
0
Jahn
Hello Ifra Saqlain - can we possibly hide values from Ticket Type field for end user?
There are around 15 values selection from the ticket type field but we want to hide 2 of them. Is this possible?
0
Ifra Saqlain
Hi Jahn Bronilla,
Type selection field means this dropdown field -
If yes, you can hide.
i). Add the below code to your script.js file.
document_head.hbs fie:
Try this and let me know if it works for you :)
Or your query is different from my solution then share screenshot to make me understand.
Thanks
0
Jahn
Hello Ifra Saqlain - thanks for your response.
Question though, I am not a developer but can follow this but really not sure where to insert those code/s. Is it from the very top or to the bottom?
0
Paul Hughes
Jahn
Just to say, this code works but it wont hide the forms from the non authenticated users which is a pain. So its only going to hide it from users who are signed in, it defeats the purpose as most users come to my Zendesk page not signed in and then see the form I wanted to hide, after they sign in its disappears which causes confusion.
It would be great if I could hide the form from appearing on the homepage from non-authenticated users.
0
Jahn
Hi Paul H - thanks for noting this one. So technically this is visible to non-authenticated users.
Oh geez, that's not good if that's the case.
0
Ifra Saqlain
Add CDN to ducument_head.js -
Add script code to scr.js file at the bottom area -
0
Paul Hughes
Ifra Saqlain
Hi Ifra,
Sorry im only coming back to you now, I tried that code you posted on December 9th 2022 but it didn't work for me. I wonder is there any other way around this.
0
Ifra Saqlain
Hey Jahn and Paul, your answer is here:
Try this and let me know.
0
Jahn
Hi Ifra Saqlain, tried and did the above you have provided and "saved" then "preview" but apparently it's not working for some reason.
Those selection from the Ticket Type below are not hidden. It's still reflecting as a selection in here.
I am changing the below to the tags which corresponds the dropdown values right?
0
Ifra Saqlain
O God!
Jahn you need to add Form IDs here not Form Name.
i). Select your form which is in the dropdown which you want to hide.
ii). You will reach to that form and get the form id in the searchbar as I want to hide New Form so I select New Form in the dropdown and I'll get the id of New Form in the search-bar 53619...4244.
iii). Copy that ID, I copied my New Form ticket ID in searchbar.
and add to your script code instead of name.
0
Jahn
Apologies Ifra Saqlain as again I am no developer and I am really not into coding but trying me best here to follow the instruction.
If I use the field ID then the entire field will be hidden in which we can't since it's where the customer select their concern.
I was able to make it work (hide) using the tags and not the form ID :). I am not hiding the whole form or ID but rather just a value from the ticket type field.
Thank you anyways for your help!
0
Ifra Saqlain
The above code is only hiding your value from the dropdown field for end-users and anonymous users. Not completely hiding.
You want to hide your form name in the dropdown so that code will hide only.
0
Jahn
The below tags actually works. I am not just using the correct tags/values earlier hence it's not hiding
Again, thank you for your help
0
Ifra Saqlain
Hi Paul, The code is for non-authenticated person-
You can try this and let me know.
Thanks
0
Jahn
All good now for me Ifra Saqlain. It's working even I am using tags which corresponds the value from the ticket type selection field.
Values we want to hide are now hidden for the end user and anonymous users.
0
Ifra Saqlain
Happy to help :)
0
Paul Hughes
Hi Ifra Saqlain
Thanks that is working for the Nesty Panel, im still stuck on hiding it from anonymous users on the homepage also,
I never did find the organization name, is there a way to hide it from the homepage also using the same method as the nesty panels?
0
Ifra Saqlain
Paul, remove the old snippet which I have provided to you before and add this new, here forms are hiding from end_users (non-authenticated users ) only on homepage and dropdown on new-request-page.
0
Paul Hughes
Hi Ifra Saqlain,
Thanks again as usual your code works brilliantly, I managed to get that working and can now hide it from non authenticated users from the homepage and the nesty-panel.
One thing that is confusing me, I have all my end users, and I have tags for two groups, Staff and Students, if I add hide for end users this means no one from either of those tagged groups will see it as they are end users.
Is there a way to hide stuff from Tagged accounts? Or a way for me to actually make user roles that would then be linked to a tag?
I want to be able to hide something from a non authenticated user and a tagged group.
0
Ifra Saqlain
Hi Paul, you can try the above solution, use form-tag instead of form-id as Jahn Bronilla did. He hides their forms from non-authenticated users. You can do like this-
if (HelpCenter.user.role=="anonymous") { -- This condition is for anonymous (non-authenticated) users.
And if you have another way you can share with us, it's good to share ideas :)
0
Paul Hughes
Hi Ifra Saqlain,
I think there's some confusion, I am already using the code below which hides the forms from non-authenticated users and its working fine.
My question is can I also hide them from users groups based on Tags? Is there a way to hide stuff from Tagged accounts? Or a way for me to actually make user roles that would then be linked to a tag?
I want to hide these forms from both anonymous users and a certain tagged group in zendesk?
I will play around with the code and see if I can restrict forms from tagged user using:
if (HelpCenter.user.tags=="student") or something similar, I just thought you might know a way
0
Ifra Saqlain
Hey Paul, actually I didn't try but I'll and get back to you with the solution :) for you.
0
Paul Hughes
Hi Ifra Saqlain,
I'm wondering if you ever found a solution for my last query? I want to hide these forms from both anonymous users and a certain tagged group in Zendesk but not sure if its possible. I haven't had any luck with the code myself.
0
Ifra Saqlain
Hi Paul,
Use the given code, add tag name:
Check your console to get name of user tags via this line of code:
Hope it helps.
0
Paul Hughes
Hi Ifra Saqlain
Unfortunately that didn't work for me but I think the reason is because no tags are being applied to my users, well at least under the console they are not.
if (HelpCenter.user.role=="anonymous" || HelpCenter.user.tags == "USERS DIDNT HAVE TAGS UNDER CONSOLE")
However under the organization there is users and tags.I seen another forum showing how to add in a organisation name, I tried adding this line but it didnt work:
if (HelpCenter.user.role=="anonymous" || HelpCenter.user.organizations[c].name == "Students") {
I think if I can add in organizations users here this will work but the code I tried didn't work, I think I'm again missing something. Thanks for all your help on this, if you see something im doing wrong please let me know.
My CONSOLE:
Current code:
$(document).ready(function () {
console.log(HelpCenter);
if (HelpCenter.user.role=="anonymous" || HelpCenter.user.tags == "USERS DIDNT HAVE TAGS UNDER CONSOLE") {
// 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();
}
});
};
removeTagsWeDontWant();
// End
}
});
0
Ifra Saqlain
Hello Paul, see you have students tag in your console. change this in the if condition;
Try the below line of code and remove previous.
0
Paul Hughes
Hi Ifra Saqlain
I had tried that already, I tried a couple of combinations but none worked. Even though in the console this is a organization tag that line of code still does not hide it.
I was browsing and found this article below, and a piece of code I found actually does hide forms from students, but this code only shows how to how from the nesty input. I also want to hide on the home page. I tried using some of this code in my current code but no joy.
Example: (HelpCenter.user.organizations[c].name === "Students")
https://support.zendesk.com/hc/en-us/articles/4408886229146?page=2#comments
0
Ifra Saqlain
So try this:
currently you have this:
try this new snippet instead of above:
0
Paul Hughes
Hi Ifra Saqlain
I have got through the console and code and don't seem to have any anchor tags, I'm assuming these are hidden, I'm not sure how to find these but I will keep trying.
0