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

Return to top
Have more questions? Submit a request

99 Comments

  • Kendall Clayton

    Hello! I am trying to populate a subject line based on the responses in two fields. The first field works just fine as it is a drop down, but I would also like to autofill with a second field that is text so that the subject reads like: 

    Form Name: "Custom Drop Down" for Customer Account Number "Text"

    1500004202322 is the custom drop down field

    1500002723962 is the text field

    Currently I have the following code and it is not working:

    <script>
    //autofills subject with drop down value of request topic and does so in this format Form Name: Value
    $(document).ready(function() {
    //field information to match with subject this one is internal support disposition
      var issuePickerTicketFieldID = 1500004202322;
    var ticketFormID = location.search.split('ticket_form_id=')[1];
    var ticketFormTitle = $('select#request_issue_type_select > option:selected').text();

    var issuePickerTicketFieldID = 1500002723962;
    var ticketFormID = location.search.split('ticket_form_id=')[1];
    var ticketFormTitle = $('text').text();


    if (ticketFormID == 1500000387101) {
    $('.form-field.request_subject').hide(); // hide subject
    $('#request_subject').val(ticketFormTitle);
    $('#request_custom_fields_' + issuePickerTicketFieldID).on('change', function() {
    var issue = $(this).next('a.nesty-input').text();
    $('#request_subject').val(ticketFormTitle + ': ' + issue + issue);
    });
    }

    });
    </script>

    0
  • Jeff Dodge

    I was able to get this to hide my custom field by using the code that was in the answer but when I go to my help center via my mobile device the custom field that is hidden on the desktop shows up on my mobile device.   Is there a different code that I need to use to have it hide on the mobile device?

    Thanks,

    Jeff

    0
  • Janaya Cassidy

    Good Afternoon!

    I'm wondering if anyone could help me with the correct code to change the 'Description' field title to a preferred alternative title e.g. Additional Information/Reason. This would allow us to customize the field and remove a similarly named field on a couple of the forms and avoid duplication. 

    Thank-you!

     

    0
  • Chris

    thanks

    If I want to apply it like below,
    Do I need to change script.js? Or which file should I change?

    ===========================================

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

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

    0
  • Kuldeep Patidar

    Hi Chris,

    That's correct - paste your code to line 10 before function closest (element, selector).

     

    0
  • TAN BING

    Dear All,

    I am able to set value for Subject by below script but unsuccessful for Description. Would you please help me. I was stuck here few days already. Tks very much for your help first.

    The end-user interface as below.

    The code in script.js as below.

    0
  • TAN BING

    Btw I find the "request-description" field is inside iframe as below. How can we assign a value by add coding in script.js

    0
  • Ifra Saqlain
    Community Moderator

    Hey,

    I tried to solve for your first asked question:

    I am able to set value for Subject by below script but unsuccessful for Description.

     

    Ans. You can change the description easily as you have done in your code.

    1). Add jquery library on your document_head.hbs file.

    2). Add the script code on script.js file.

     

    3). Output is:

     

    Make sure the console tab into your inspect tool should be clear if there are any issue then may be that's the reason because it happens, when the console shows error for single code/line/variable in the script then below code of that code/line/variable don't work.

    Do one thing, comment all your custom code and just leave uncomment only the line you have written:

     $('#request_subject').val('test subject'); 
    $('#request_subject').css('color', 'red'); 
    $('#request_description').val('test description'); 

     

    now test working or not and let me know if not working. Then I'll try on your working theme which you will set as live.

     

    Thanks

     

    0
  • Ifra Saqlain
    Community Moderator

    Hi Tan Bing,

    Here is your second answer of your second question:

    Btw I find the "request-description" field is inside iframe as below. How can we assign a value by add coding in script.js

     

    Ans. The process is same you can assign the tags and content in the val() function.

     

    Output is:

     

    If any query let me know :)

    Thanks

     

     

     

    0

Please sign in to leave a comment.

Powered by Zendesk