Hide an option in a custom dropdown field from end user on request form

Answered

3 Comments

  • Bonnie Schofield
    Comment actions Permalink

    I really didn't receive much help other than a suggestion to read a support doc or to contact support for custom code.

    Instead I reached out to our own IT team and we came up with a very simple, elegant solution! I think I might post this elsewhere on your site so others could replicate if they have a similar use case.

    Wonder if Zendesk might also think about adding this function as part of your out-of-the-box solution? It's really helpful to have only one topic list (instead of an internal and external) displayed after the Form is selected.

    The following simple code needs to be added on the JS page under 

    $(document).ready(function() {
     

    1) Create a variable to store the tags of options that we want to hide from end-users. Multiple tags can be added with a comma separation.

    var tagsToRemove = ['manually_canceled'];

    2) Execute logic to remove the options:

    removeTagsWeDontWant();

    3) Here's the code added at the end of the JS page:

    function removeTagsWeDontWant() {
    $('.nesty-panel').on('DOMNodeInserted', function(e){
    for(var i in tagsToRemove) {
    $('li#' + tagsToRemove[i]).remove();
    }
    });

    }

    2
  • Madison Davis
    Comment actions Permalink

    Glad to hear you found a solution, Bonnie, and thanks for sharing! I'd definitely encourage you to share this for others to use. 

    0
  • Saranya Sarika
    Comment actions Permalink

    Hi!

    I would like to hide some options from a custom drop down field from end users. I tried to edit the code but I could not find the $(document).ready(function() since we are using a custom theme. 

    May I know where else I can edit it instead?

    Thanks! 

    0

Please sign in to leave a comment.

Powered by Zendesk