Disabling the subject and description fields on the new request form in Help Center

Return to top

106 Comments

  • François Bellavance

    Hi Ifra Saqlain

    It all worked perfectly. I now just need to find how to hide the CC part, followers do not hide CCs.

     // Formulaire Bookings STNRI
     if(ticketForm == 6646835498899) {
        $('.form-field.request_subject').hide(); // Hide subject
      $('.form-field.request_description').hide(); // Hide description
      $('.form-field.request_followers').hide(); // Hide CCs
        $('#request_subject').val("Création d'une instance de Bookings - calendrier"); // autofill subject 
        $('#request_description').val("Création d'une instance de Bookings - calendrier"); // autofill description
      $('.form-field label:contains("Attachments")').hide(); // Hide label for Attachments
        $('#upload-dropzone').hide(); // Hide upload box for Attachments
     }

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member of The Year - 2021

    Hi François Bellavance. :)

     

    You can disable CCs part using the settings:

    https://support.zendesk.com/hc/en-us/articles/4408843795482-Configuring-CC-and-follower-permissions#topic_x3t_4p5_cq

     

     

     

    OR

     

    Share the public URL of your HC then I can share script code to hide via code.

     

     

    Thanks

    0
  • François Bellavance

    I don't know what's the public URL of our HC because we have setted it to only connected users, it's not public at all. Yet we have another brand wich is public.

    Transport Scolaire (zendesk.com)

    I'm also hiding some parts of the public brand.

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member of The Year - 2021

    François Bellavance,

    You are hiding CC field for this form:-

     

     

     

    I opened this form:

     

     

    there doesn't exist this field. 

     

     

    0
  • Paul H

    Hi Ifra Saqlain

    Im following all the code provided here and all is working great code below, I have two functions one for hiding the subject and one to hide the description and it works when i select from one of the choices in my dropdown. I have two choices

    Dropdown One is Submit a request

    Dropdown Two is Student Assistant Fund Request

    Issue im facing is, when i select Student Assistant Fund Request it will hide the subject and description like i want, but when i click back on Submit a request the boxes stay hidden and I would like them to be shown again, is this possible? It seems to only way for these boxes to reappear is by refreshing the page. 

    Code:  

      // Hide the Subject and Description boxes when these fields are selected. 
            
        $(document).on('change', '#request_custom_fields_4940267078044', function() {
    hideDescription();

    });
        
        
     function hideDescription() {
    var selected = $('#request_custom_fields_4940267078044').val();
        
    if (selected != "4940267078044") {
        $('.form-field.request_description').hide();    
       tinymce.get("request_description").setContent("<p>Student Assistance Fund - Full Time Application 2021/2022</p>");
        }
      else {
         $('.form-field.request_description').show();
    tinymce.get("request_description").setContent("");
      }
    }   
               
          $(document).on('change', '#request_custom_fields_4940267078044', function() {
    hideSubject();

    });
        
          function hideSubject() {
    var selected = $('#request_custom_fields_4940267078044').val();
        
        if (selected = "4940267078044") {
    $('.form-field.request_subject').hide();
    $('#request_subject').val('Student Assistance Fund - Full Time Application 2021/2022'); // Autofill subject 
      
      }
       }
        

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member of The Year - 2021

    Hi Paul H :)

    Can you share your URL here?

    1
  • Paul H

    Hey Ifra Saqlain

    Thanks for coming back so fast,

    Here's the link to my form: My Form

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member of The Year - 2021

    Hi Paul H :), I know It's too much late to answer.

    So, do the following:-

     

    Remove your previously added script code and add the given below.

    $(document).on('change', '#request_custom_fields_5362232247188', function() {
       hideSubject();
        hideDescription();

    });

    function hideDescription() {
      var selected = $('#request_custom_fields_5362232247188').val();
        
      if (selected == "student_assistant_fund_request") {
        $('.form-field.request_description').hide();    
        var descText = 'Hello Zendesk!';
        $('#request_description').val(descText);
        }
      else {
         $('.form-field.request_description').show();
         $('#request_description').val('');  
      }
    }

    function hideSubject() {
      var selected = $('#request_custom_fields_5362232247188').val();
        
      if (selected == "student_assistant_fund_request") {
       $('.form-field.request_subject').hide();   
        var descText = 'Hello Zendesk!';
        $('#request_subject').val(descText);
        }
      else {
         $('.form-field.request_subject').show();
         $('#request_subject').val('');  
      }
    }




    student_assistant_fund_request: TagName of your option in the dropdown.
    #request_custom_fields_5362232247188: Custom field ID.

    That's my field ID, remove it and add yours.
    That's my tagName, remove it and add yours.




    Get the field ID:- Support > Admin Center > Objects and rules > Tickets > Fields > See the 'Request Type' > Copy the ID > Add as I did above (#request_custom_fields_ADD HERE)









    Find the tagName of your dropdown option, Student Assistant Fund Request :- Support > Admin Center > Objects and rules > Tickets > Fields > Click on 'Request Type' > Now, you have entered to get the tagName > Copy the tagName and add as I did above (student_assistant_fund_request)

     

     

    If any confusion feel free to ask :)

    Thanks

    1
  • Paul H

    Hi Ifra Saqlain,

    No never too late to answer, your code worked perfectly, you are a life saver. 

    Thank you so much, 

    Paul

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member of The Year - 2021

     😊️

    0
  • Kevin Sanchez

    Hello! Hoping to get some assistance here.

     

    We have a use case where we hide the subject & description fields on certain forms.

    But we've encountered an issue where we're using custom URL's to pre-populate some fields, but when those URL's are used it seems that the Javascript doesn't execute and the Subject & Description fields are then shown. Is there a solution to this?

    Or some way to ensure the javascript executes no matter how the request page is loaded?

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member of The Year - 2021

    Hello Kevin Sanchez

    Can you share the URL of your HC? 

     

    Thanks

    0
  • Brett Bowser
    Zendesk Community Manager
    Hey Hazel,
     
    Can you confirm that you've made the fields both visible and editable to end-users in the agent interface? If that's not the issue, can you share the code you're using that's not functioning properly?
     
    Thanks in advance!
    0
  • Paul H

    Hi Ifra Saqlain

    Wondering if you might be able to help me here as you did before. 

    I had all my code working and it was perfectly hiding the subject and description and auto filling both, worked great. But I'm after changing themes and for some annoying reason now the Description is not auto filling, it still disappears but doesn't auto fill, if you have any ideas of what might be causing this id be so grateful as I've tried everything. 

    Here's a link to my page.

    Code below:

     $(document).on('change', '#request_custom_fields_5290902356252', function() {
       hideSubject();
        hideDescription();

    });

    function hideDescription() {
      var selected = $('#request_custom_fields_5290902356252').val();
        
      if (selected == "msc_research_project_internship") {
        $('.form-field.request_description').hide();    
        var descText = 'MSc Research Project / Internship Public Cloud Requirements Form has been submitted to the NCI Support Hub';
        $('#request_description').val(descText);
        }
      
       else if (selected == "new_starter_form") {
        $('.form-field.request_description').hide();    
        var descText = 'New Starter Form has been submitted to the NCI Support Hub';
        $('#request_description').val(descText);
        }
      
      else {
         $('.form-field.request_description').show();
         $('#request_description').val('');  
      }
    }

    function hideSubject() {
      var selected = $('#request_custom_fields_5290902356252').val();
        
      if (selected == "msc_research_project_internship") {
       $('.form-field.request_subject').hide();   
        var descText = 'MSc Research Project / Internship Public Cloud Requirements Form';
        $('#request_subject').val(descText);
        }
      
       else if (selected == "new_starter_form") {
       $('.form-field.request_subject').hide();   
        var descText = 'New Starter Form';
        $('#request_subject').val(descText);
        }
      
      else {
         $('.form-field.request_subject').show();
         $('#request_subject').val('');  
      }
    }

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member of The Year - 2021

    Hey Paul, get back to you soon ,with the solution :)

    1
  • Paul H

    Hi Ifra Saqlain,

    Thank you,

    0

Please sign in to leave a comment.

Powered by Zendesk