Recent searches


No recent searches

Hide Subject and Description System Fields

Answered


Posted Sep 02, 2020

There are a few of our request forms where the default sytem fields Subject and Description are not required and I would ideally like to hide them.

From what I have read on other similar posts that the fields can be auto completed and hidden using Javascript or jQuery.

Following the example of the article https://support.zendesk.com/hc/en-us/articles/115002860148-Disabling-the-subject-and-description-fields-on-the-new-request-form-in-Help-Center- this is the code I have tried to use but after publishing the changesthe fields are still visble.

var ticketForm = location.search.split('ticket_form_id=')[1];

if(ticketForm == 360000116238) {
$('.form-field.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
}

Can someone point me in the right direction to get this to work

Thanks

 

 


0

13

13 comments

Hey Ryan,

Below here is the code I normally use to achieve this:

 

  if(ticketForm == 360001824553) {
 
      $('#request_subject').val('Mandatory Document Submission');
 
      $('#request_description').val('Mandatory Document Submission');
 
      $('#request_subject').parent('.request_subject').hide();
 
      $('#request_description').parent('.request_description').hide();
 
  }
 
Example here:
 
 
 
 
Are you able to give this version of the code a try? Mine differs slightly in the lines which HIDE the fields. This code hasn't failed me before so hopefully should do the trick for you as well. 
 
Let us know how you go. :)
 
Best,
 
Amie

0


Hey Amie,

I have given your code variation a go and updated the script.js however after publishing the code and reviewing the form both the subject and description fields are still visible.

Here is the code for reference, which looks all good.

 

Thanks for you help so far :)

Ryan

0


Hey @...

It should work in regards to the way you show your code using Amies' example.

Have you tried wrapping your statement in a document.ready function?

jQuery( document ).ready(function() {
//add your code inside here.
});

0


Hey @...
Did you solve this issue? I am running into a similar situation. 

0


Hey everyone, 

I forgot to add the crucial bit to make this work since the HC theme has been updated within the last 12months around jQuery. 

We need to add this script to the document head page in the HC theme:

<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>

Once you add this script, the above code I mentioned will then work for you. :)

Best,

Amie

1


Hi everyone,

I just try Amie's code to hide subjects fields . But the fields are still visible.

Can anyone help please.

Thanks Bernard

1


I am facing the same problem. 

I added the mentioned code in the document head page then added the code in the script.js page and replaced the form ID by the intened form and it did not work with me. Please suggest another solution. I just need to hide the description box only.

Amie Brennan

0


image avatar

Noly Maron Unson

Zendesk Customer Care

Hi Mohannad,

I created a ticket on your behalf so that we can discuss this via email. Please respond to my email so that we can continue with the troubleshooting.

Thank you.

0


Can someone provide some help?

I was able to hide and fill the subject and description with the following code but I would like to autopopulate de description with a custom ticket field that is being filled in the same ticket form. Is that possible?

0


Hey Ulises,

I've used the below code before to Auto set subject and populate with a value from a drop-down menu. It will also hide the subject field as well. 

     var TicketFieldID = 900004383126;

  var ticketFormID = location.search.split('ticket_form_id=')[1];

  var ticketFormTitle = $('select#category_type > option:selected').text();

  

if (ticketFormID == 900000061706) {

    $('.form-field.request_subject').hide(); // hide subject

    $('#request_subject').val(ticketFormTitle);

    $('#request_custom_fields_' + TicketFieldID).on('change', function() {

      var issue = $(this).next('a.nesty-input').text();

      $('#request_subject').val(ticketFormTitle + 'New Maintenance Request: ' + issue);

    });

  }

Hope it helps. :)

0


Amie Brennan I used this method in Copenhagen Theme version 3 and it works perfectly. The same method does not seem to be working in version 4 can you please share any additional steps needed for v4 and where the changes need to be made. 

0


I'm having the same issue as Stuart.  Seems to not work with version 4, but was working with version 3 just fine.  Not sure what's changed . . . 

0


This request was closed and merged into request #12995313 "[Community Post] Pesquisa de NPs".

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post