Hide Specific Dropdown Values
Answered
Posted Sep 01, 2023
I am looking to hide specific dropdown values based on a form selection.
We use a form by product approach and for a specific product we only want the option to select High or Urgent as the priority.
Is this possible?
0
18
18 comments
Zach
@Ifra Saqlain, I have added this snippet at the bottom of my script.js but am still seeing the option in my drop-down… Any suggestions?
11122233344456 is the Form ID placeholder and my_field_value_tag is the value tag for the option in the field I want to hide
0
Ifra Saqlain
Hi Lee,
You missed the inverted coma, try this and let me know :)
Thanks
0
이지훈
And in this code, the ticket form ID and tag are anonymized.
0
이지훈
Hi Ifra Saqlain.
I tried the code below and it worked in July.
My savior~!
Is there any way to solve this?
0
Ifra Saqlain
Hi 이지훈(Lee jihoon),
Please explain your use case so I'll customize the code.
Thanks
0
이지훈
Hi. Ifra Saqlain
Currently, 'DOMNodeInserted' is not available as per the comment below, so the solution you mentioned does not work.
https://support.zendesk.com/hc/ko/community/posts/4409217680410/comments/7741431026074
Have you found any clever way to solve this? I really need your help.
0
Noelle Cheng
1263169183150 Thank you so much! Looks like someone was able to help me out on it and their suggestion worked. I really appreciate all your contribution and help!
0
Ifra Saqlain
Noelle Cheng, okay I can try to solve this query, please share that link.
0
Noelle Cheng
Hi 1263169183150 So sorry to bug thank you though! I need the two options to still be visible so I may just conditionally hide the other fields if that option is selected.
I hate to bother you about something unrelated from this post but you have been such a huge help in the community, I was wondering if you could help me on a code I seem to be having issues on regarding attachments based on a drop down selection? If I provide the link to my post, would you be open to helping me? Thanks!
0
Ifra Saqlain
Hi Noelle Cheng, thanks for your recent comment. :), I was traveling (between two states) that's why I wasn't able to answer.
I can help you to hide specific values of a dropdown on a specific form but without a second condition as that's not doable for me. I've tried so many times to work with the custom dropdown's value but didn't get any output.
Code for use: hide specific values of a dropdown on a specific form
var tagsToRemove = ['0000000000','1111111','2222222']; //value to hide from dropdown
function removeTagsWeDontWant() {
$('.nesty-panel').on('DOMNodeInserted', function(e){
for(var i in tagsToRemove) {
$('li#' + tagsToRemove[i]).remove();
}
});
};
if (window.location.href.indexOf("456898764") > -1) { // form id for which you want to hide value of dropdown
removeTagsWeDontWant();
}
Note: 0000000000 my dropdown value and 456898764 my form id, remove this and add yours
Thanks
0
Sign in to leave a comment.