Hiding a ticket form on the 'submit a request' page
AnsweredHi!
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!
-
Hi Dawn Anderson,
Just follow the steps below:
1). Copy the below script code paste it into script.js file.
var tagsToRemove = ['360000674612']; //special form ID
function removeTagsWeDontWant() {
$('.nesty-panel').on('DOMNodeInserted', function(e){
for(var i in tagsToRemove) {
$('li#' + tagsToRemove[i]).remove();
}
});
};
removeTagsWeDontWant();Screenshot for the same:
Make sure you have added the jQuery Library into document_head.hbs file.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
Screenshot for the same:
2). The form ID inside the array - var tagsToRemove = ['360000674612'];
360000674612 - it's my form ID, you need to remove this and add your special form ID.
special form ID - Form you want to hide from the dropdown list.
Hope it work for you, if any issue let me know :)
Thanks
Team Diziana
-
Hi @...
Have followed your steps but the form is still present in the drop down list?
-
It's working perfectly for me.
Can you share the public URL of your HC after setting your working theme live?
-
Of course, https://support.vivaladiva.com/hc/en-gb
-
When I added the code, it didn't remove the form but it removed the hero image & search bar from the help centre? Had to remove it as we need these features to be visible.
-
Hi,
Fix the below error and then apply my code that would work.
Code has an issue.
-
Hi @...
Should I just remove that section from the code? Not sure what it does?
-
Yes you can remove it and then try and let me know :) so I'll find out the way for buggy setTimeOut();
but first remove that buggy function and try for the ticket code.
-
hI @...
I tried what you suggested but am now getting the below error:
When I remove that line from the document head the hero image comes back. Just tried the code and I don't need it in document head - just the bit in the code is hiding it on the page :)
Thanks for your help, got there in the end :)
-
Ifra Saqlain - thank you this is great!
Could I confirm this is how would we do this for multiple forms?
var tagsToRemove = ['FORM1ID', 'FROM2ID']; //special form ID
function removeTagsWeDontWant() {
$('.nesty-panel').on('DOMNodeInserted', function(e){
for(var i in tagsToRemove) {
$('li#' + tagsToRemove[i]).remove();
}
});
};
removeTagsWeDontWant(); -
Yes, you can as you shared the array code, just add the ticket IDs inside the array.
-
Hi Ifra Saqlain<
Would appreciate some help with how to accomplish this in our help center
var tagsToRemove = ['360000674612']; //special form ID
function removeTagsWeDontWant() {
$('.nesty-panel').on('DOMNodeInserted', function(e){
for(var i in tagsToRemove) {
$('li#' + tagsToRemove[i]).remove();
}
});
};
removeTagsWeDontWant();
Is this all I need to add and would this be added under script.js? -
Hello Alaya Team,
Yes, the code mentioned above would be add on script.js file at the bottom area but under the DOM function, please see the provided screenshot to reach the point easily.
document.addEventListener('DOMContentLoaded', function() { // It's the DOM function
// Key map
var ENTER = 13;
var ESCAPE = 27;
var SPACE = 32;
var UP = 38;
var DOWN = 40;
var TAB = 9
....................
YOUR CODE WHICH IS ALREADY ADDED
....................
//Code for some specific ticket forms -- Start
var tagsToRemove = ['360000674612']; //special form ID
function removeTagsWeDontWant() {
$('.nesty-panel').on('DOMNodeInserted', function(e){
for(var i in tagsToRemove) {
$('li#' + tagsToRemove[i]).remove();
}
});
};
removeTagsWeDontWant();
// End
});Screenshot:
If any confusion, do let me know :)
Thanks
Ifra Saqlain
-
I think you are using jQuery so you can add script code like this:
$(document).ready(function (){
//Code for some specific ticket forms -- Start
var tagsToRemove = ['TICKET-FORM-ID-1', 'TICKET-FORM-ID-2', 'TICKET-FORM-ID-3']; //special form ID
function removeTagsWeDontWant() {
$('.nesty-panel').on('DOMNodeInserted', function(e){
for(var i in tagsToRemove) {
$('li#' + tagsToRemove[i]).remove();
}
});
};
removeTagsWeDontWant();
// End
});Only copy the above code and paste it at the bottom/last after all code on script.js file.
Screenshot for the same:
Replace the IDs with your ticket ID: var tagsToRemove = ['TICKET-FORM-ID-1', 'TICKET-FORM-ID-2', 'TICKET-FORM-ID-3'];
and do nothing else.
You will get the ticket-form-ids in the searchbar:
You see the numbers are your ticket ID, same as you can get other ticket IDs.
Press the dropdown bar and select the ticket:
After that, when your selected ticket would be appear on the window you can see the ticket ID in the search-bar.
Note: If you write custom code using jQuery then please write under the DOM else your code won't work properly or throwing error.
$(document).ready (function (){
// Your custom code here
});
Hope it work for you.
-
Is it possible to add a way for a user who is a member of a specific organization can still see the ticket?
There is an article that says you can restrict forms based on organization, but I want to hide the form from users who are not signed in as well.
-
Dawn Anderson Can I possibly ask you what theme you're using for your help center? I really like the looks of it. Thanks!
Please sign in to leave a comment.
16 Comments