How can I hide or remove the subject and description fields on the submit a request form in the help center?
It's possible to hide the subject from your request form, but it's not possible to natively hide the description field.
To hide the subject field from the request form
- Go to Admin Center > Objects and rules > Tickets > Fields.
- Open the Subjectfield.
- Under Permissions, select Customers can view.
- Select Save.
Customers won't see the subject field in the request form, but the field is visible in the customer portal.
- In Guide, click the Customize design icon () in the sidebar.
- From the theme you want to work with, click Customize.
- Click Edit code and add the example code below in the script.js template.
$('.form-field.string.optional.request_subject').hide();// Hide subject
$('.form-field.string.required.request_subject').hide(); // Hide subject
$('.form-field.request_description').hide(); // Hide description
$('#request_subject').val('test subject'); // Autofill subject
$('#request_description').val('test description'); // Autofill description
- Select Publish.
The created tickets will have the subject and description fields auto-populated as in the example below.
Thanks, Ifra Saqlain! So that was in our testing environment. I updated that, it worked perfectly, and then I moved to prod. Unfortunately, now I can't get it to work in our prod environment. Can you possibly have a look again? HC here.
Hi Nicole :), I just saw the theme and all is work fine for both forms:
I figured out one more thing, you don't have this ID (1500003176142) in your any form but you added in the code with the 'if' condition:
It may be:
Hi Ifra Saqlain! So I am just beginning to work with this actual instance of the HC. At at the bottom of the js, I added the code found on this page. Right above what I added there was existing code that also seems to take the subject off two forms. I didn't write this portion but was equally intrigued. I tried to copy the lines and add in the new form id number but it still didn't hide the subject.
Now oddly enough, the form 1500003055361 was a duplicated form, reworked, and then set in place. What line number did you find that snippet you posted in the js file? I did a double take and can't find it in the js file.
Thank you! :)
Oh my goodness, I am so sorry! I just realized what I was doing. I was in the wrong brand HC, lol! If you didn't post about the form number changing, I probably wouldn't have realized it. I put the code in the right HC brand, and now the form has it hidden as we were looking to do. I tested things and everything seems to be working well. Thank you, as always, for your time!!!
Hi Ifra or anyone still awake,
I've been trying to hide the subject and description from a specific form ID 7769763237147, which is for a specific brand, but no matter how many variations of everyone's code I've pasted and published in the script.js, I can never hide and fill them, can anyone help me?
This is the code i have currently all the way at the bottom on my script.js
@Bernard Ugalde, try this type:
Same result, they're still there
@Bernard Ugalde, Remove that and use this:
Hi Ifra Saqlain,
That finally did it. Thank you so much.
Perhaps I've missed something but I'm hoping someone can help - I am successfully able to hide the subject and description fields, but if an end-user forgets to fill in a required field and clicks Submit, the fields show back up again.
Is there any way to validate all the required fields BEFORE the page refreshes? Any code I can put in place to stop the subject and description fields from returning after a failed submit?
Hi Eddie Sawyers, try this,
add field IDs or classes and validate those.
I followed your recommendation on the first page of comments this articles to set up a webhook & trigger to updates the subject field with a title & placeholders. (https://support.zendesk.com/hc/en-us/articles/4408882841498/comments/4408894285466)
Everything has been fine until I've got to the last bit on the trigger, where in the JSON body I'm getting a Parse error:
Any tips on how I can rectify this please?
Thank you so much in advance
I have been successful in getting the value input from a previous textfield and populating the Subject field with it:
but I haven't been able to do it when the field is a datepicker type:
It is actually pulling the value just fine, but I think the problem is with the event. Only when I click on the label above the field does it populate the Subject field with "Date is xx-xx-xxxx" but I want the event to fire when a date is picked using the datepicker. I have tried various event types but none of them seem to work.
I can't get a drop-down field to populate my Subject with values at all.
Hey Mark Z,
Try this updated code:
Thanks for your reply. I tried your code and at first it did not do anything and also no errors in the console, but then I think you just forgot the # on this line for the custom field:
I added it, but now it functions the same way as my code previously. I mean, the Subject field does not populate with "Date is xxxx" upon selecting a date from the DatePicker, rather it populates once I click on the label of request_custom_fields_2. I don't really understand the reason for this.
In other words, I click on the textfield request_custom_fields_2 to open the Datepicker... then I select a date... the selected date appears as text in this field ONLY... until I click on the label above it. When I click on the label above the custom field, then Subject populates with the date.
Mark Z, because you added click event:
Try this: Remove click event.
My updated code with the date:
Hmm, well now it populates the Subject field with the current date and time as soon as the page loads :)
I think it needs to run when the date is chosen in the DatePicker, but I don't know which event I can use for that.
Same problem for a drop-down field.
Any other ideas?
So if you hide the description field, I know we can auto-populate/fill the field with a static phrase. Is there a way to copy a particular field on the form into the description field instead?
Yes, please see my previous comment. You can use it to fill the subject field from a custom field with this:
You should be able to adapt this for the Description field.
@Mark Z, which plugin are you using for the date-picker?
Ifra Saqlain No plugin, it is simply the default which is used when you select the Date field type in ZenDesk.
In case anybody is looking to get the text from a selected drop-down item:
@Mark Z, if possible share your HC URL where you are working.
Unfortunately I can't share it as it is being used in production with user authentication enabled. But it is a standard Date field, so you should have the same issue no matter where it is being used. (namely, which event handler can we use for when the user chooses a date in the Date field?)
No problem, I'll look at it by adding date field to my form.
Ifra Saqlain I hope you can help me out on my issue.
Hi Vamshi R,
Add the code to your script.js file but you need to add your form ID and field ID or class name as I mentioned below where to add.
To hide description field:
To hide the Email address field:
You can find your form ID in your search-bar.
Hi Ifra Saqlain
I just used below code and now i am able to hide Description and your email address field.
But i have one more concern, how can i populate a custom ticket field data on your email address field. Below is the screenshot of the field which i need to populate.
It seems to me that ZenDesk disabled many functions of jQuery. For example not all event handlers can function with standard text fields or labels (like mouseenter), and some fields like Date do not allow any events handlers at all (that I have tried).
It would be nice to get some documentation about this from ZenDesk but I have not found any.
Please sign in to leave a comment.