Updating ticket form description field with text

回答済み

9 コメント

  • Amie B

    Hey Joe,

    You can try this code below.

    document head:

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

     

    The form ID would be the ID for your Address Change form. This needs to be placed on the script.js page before the social media JS.

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

      if(ticketForm == 360001721394) {

          $('#request_description').val('Address change form');

    $('#request_description').parent('.request_description').hide();

      }

    Hope fully this will do the trick for you. :)
    0
  • Joe M

    Hi Amie,

    Thanks for getting back to me.  Same issue is happening.  It hides the description field when the form opens but when I try to submit after the recaptcha, the description field reappears with the error message.  So the description is not being filled in with the 'Address change form' text?  Any other ideas?

     

    0
  • Thomas Verschoren
    Community Moderator

    This should work

    $(document).ready(function() {
    const queryString = window.location.search;
    const urlParams = new URLSearchParams(queryString);
    form = urlParams.get('ticket_form_id')

    //enter your FORM IDs here
    if (form == "360000166297" || form == "360000182857"){
      $('.request_description').hide(); // Hide description
    $("#request_description").val("hello there"); //Set Descriptions
    }
    });
    0
  • Joe M

    Hi Tom,

    No luck with this either.  Same thing description disappears but still still not being filled in with the text.

    When page loads no description

     

    When page is submitted after reCAPTCHA

    0
  • Joshua Paulsen

    I'm having the exact same issue. Have tried following instructions provided here and in several other posts related to autofilling the description field, but am unable to get anything to stick. I'm able to successfully assign values to the subject field and other custom fields, but get the same error as Tom is describing when trying to fill & hide the description field.

    0
  • Thomas Verschoren
    Community Moderator

    You can find a working example here:

    https://support.verschoren.com/hc/en-us/requests/new?ticket_form_id=360000314600

    {{request_form}}

    <script>
    $(document).ready(function() {
    const queryString = window.location.search;
    const urlParams = new URLSearchParams(queryString);
    form = urlParams.get('ticket_form_id')

    //enter your FORM IDs here
    if (form == "360000314600" || form == "360000182857"){
    $('.request_description').hide(); // Hide description
    $("#request_description").val("hello there"); //Set Descriptions
    }
    });
    </script>
    0
  • Joe M

    Hi all,

    I took following code snippet out of the $(document).ready(function() {}); and now it seems to work.  I am not entirely sure why but after a few tests it does seem to work.  Joshua, I hope this helps you out. 

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

     if(ticketForm == ‘my_ticket_id’) {

         $('.request_description').hide(); // Hide description field

         $('#request_description').val('Address change form');  //Add text to description field

      }
    0
  • Amie B

    Hey Everyone - 

    Just to confirm, the code in Joe's last reply above me here needs to go into the script.js page. I generally put it towards the top just before the social media JS. 

    Best,

    Amie

    0
  • Joshua Paulsen

    Thanks Joe, you're brilliant! 

    0

サインインしてコメントを残してください。

Powered by Zendesk