Hide ticket fields in web widget | Community
Skip to main content

Hide ticket fields in web widget

  • April 22, 2020
  • 12 replies
  • 0 views

Hi,

I would like to hide the email field in the web widget. I found this post: https://support.zendesk.com/hc/en-us/community/posts/360029388034-Hide-some-fields-from-the-widget- 

It redirects you to this post: https://support.zendesk.com/hc/en-us/community/posts/360004395348-Hiding-system-fields-in-Web-Widget  

Which I am not authorised to view. Can someone either help me with the js code, or give my access to view that post? 

Thank you,

Amy

**Added 9th June: Feature Request (https://support.zendesk.com/hc/en-us/community/posts/360046753854-Feature-Request-Hide-ticket-fields-in-web-widget)**

12 replies

Devan
  • April 22, 2020

Hello @Amy Ogborn,

The link you shared lead to an old EAP that is no longer live, sorry for the confusion. I've gone ahead and updated that post, so it shouldn't cause any more trouble. As for your question, I'll see if our Moderator team can offer a solution. Otherwise, I'll be sure to share this in our Weekly Digest so other members of the community can share their expertise. 

Best regards. 


  • Author
  • April 23, 2020

Thanks @Devan - I look forward to see if anyone can help me out here :) 


@Amy Ogborn

Try this code and see if it helps.

https://github.com/Ajhad1/Zendesk-Web-Widget-Modifications


  • Author
  • April 28, 2020

@Alejandro Colon - Thanks. Unfortunately I can't get it to work.

I am putting in the script.js file  and changed the below line to reflect the classes in my helpdesk

#Embed > div > div > div > form > div > div.sc-cpmKsF.fvnioU > div:nth-child(1) { 

But it isn't hiding the fields. I don't think it's finding the fields to start with.

Any guidance? Thanks in advance


@Amy Ogborn

Make sure you are putting the code after the initialization of the widget. 

Note: This code is only run when the widget is opened. 

 

By default, I commented out all of the individual lines to make sure that the code does not have unintended effects.

Make sure you uncommented the section you are trying to use. 

 

The code should be added to the same place you are adding the initialization of the widget. You should not be inputting the file anywhere. 

 

I updated the documentation at the link to help explain this.


  • Author
  • April 29, 2020

407663839954 

Yes, I missed that I had to put it after the widget. Thanks!

The bit that was breaking it for me is that in your code you have forgotten to close the function. Just in case any one else needs this code :)


Thank you so much on helping me fix days of torment! Much appreciated.

 


@Amy Ogborn

I will update that right away. 

Glad the code helped you. 

 

I was tired of seeing the same requests for the past 5 years and Zendesk not doing anything about it.


Active Feature Request (please vote):

Feature Request: Hide ticket fields in web widget

@Amy Ogborn

I just posted a Feature Request for this at the link below. If you would like to see this feature please head over there and show your support. Please make sure to add an upvote and comment even if it is simply a "+1"

Also, you may consider adding it to your post to get the feature request more visible.

https://support.zendesk.com/hc/en-us/community/posts/360046753854-Feature-Request-Hide-ticket-fields-in-web-widget


  • March 31, 2021

We solved this using this Javascript, where "xszt60-1.dLJShQ" is different for each widget.

<script type="text/javascript">
zE('webWidget:on', 'open', function () {
var style = document.createElement('style');
/*name*/
style.innerHTML = `.xszt60-1.dLJShQ > div:nth-child(1) {display: none;}`;
/*email*/
style.innerHTML += `.xszt60-1.dLJShQ > div:nth-child(2) {display: none;}`;
/*organization*/
style.innerHTML += `.xszt60-1.dLJShQ > div:nth-child(3) {display: none;}`;
parent.document.getElementById('webWidget').contentDocument.head.appendChild(style);
});
</script>

But I have a question: can this ID change at some point? Is this always like this for each Zendesk instance?


  • October 20, 2021

It gives me this error, with this script.


  • August 21, 2022

@...

Alejandro says:

The reason you were unable to find that repository as it was deprecated for a new one. https://github.com/Ajhad1/Zendesk-Customizations

Look under web-widget folder for the code you are looking for. 



  • August 19, 2024

Hi Team

 

Could you please provide an option to hide the nested ticket fields as well please? When we add nested fields (example- Field :: 1, Field :: 2, etc) and if we have to hide them, the field does not get hidden completely. The ‘Field >’ option will still show on the ticket page but it will be blank without options. This is confusing to the agents while selecting a ticket field for a ticket. Can you please enable the Ticket Field Manager app to hide the entire field when we add tags to hide options?