0

I want to start by saying I am not a coder but I am trying to edit code in Zendesk to auto fill and hide the required subject and description fields. Here is the code I put in the script.js at the top:

$(document).ready(function() {
$('#request_subject').val("vaccine request");
$('.request_subject').hide();
$('#request_description').val("vaccine");
$('.request_description').hide();
$('.form-field label:contains("Attachments")').hide();
$('#upload-dropzone').hide();
});

The request subject auto fills on the form but the request description will not populate. Once the form is submitted it returns an error that description cannot be blank. If anyone has any suggestions I would be most grateful. We are trying to launch this today to start pushing out vaccines next week but I cannot get this to work.

I'm sure I've made a simple mistake because I don't know enough about coding but after spending hours trying to decipher the problem I am taking a chance that someone on here can help. Thank you in advance for any assistance.

j08691
  • 204,283
  • 31
  • 260
  • 272

1 Answers1

0

We need more information to answer your question, mainly a chunk of HTML with the form you are trying to manipulate.

$(document).ready(function() {
$('#request_subject').val("vaccine request");
$('.request_subject').hide();
$('#request_description').val("vaccine");
$('.request_description').hide();
$('.form-field label:contains("Attachments")').hide();
$('#upload-dropzone').hide();
});

In your code snippet, you have $('#request_subject').val("...") which would imply that there is a form element, probably something like this:

<input id="request_subject" type="text" value=""></input>

Right after that you have $('.request_subject').hide() which implies a different element. One with a class. Maybe this is intentional?

<div class="request_subject">
  <input id="request_subject" type="text" value=""></input>
</div>

It's hard to know.

If the selectors are correct, then your code should work. Here is a Stack Overflow question about setting the values of text areas.

Based on the information in the question, this is pure speculation, though.

Will
  • 3,201
  • 1
  • 19
  • 17
  • Thanks so much for your assistance Will! The error has been identified and resolved - it was a wysiwyg error in Zendesk that I would have never found without their assistance! Have a wonderful weekend! – Ruthie Buckler Jan 15 '21 at 21:47