Using Zendesk placeholder in Help Center | Community
Skip to main content

Using Zendesk placeholder in Help Center

  • August 5, 2022
  • 3 replies
  • 0 views

Hi,

I want to pre fill the subject field with username and form name. Is this possible ? 

I have the following snippet, but have tried every iteration of placing the required placeholder to no avail.

$('#request_subject').val('hello world'); // Autofill subject

Please help 

3 replies

Jack23
  • August 5, 2022

Hi Foad,

Are you waiting until the page is fully loaded when executing that line of code?


  • Author
  • August 5, 2022

Does the ticket need to be submitted ?

The above code works.. however the 'hello world' is static .. I would like this dynamic and to include the username / form name


Jack23
  • August 5, 2022

Apologies, I misunderstood! You can get the users name (if they are signed in) from HelpCenter.user.name (try type it into the console when viewing your HC to see what I mean) but for the ticket form name it’s possible but you’d probably either need to read the value from the issue select drop down (if you have more than one form and it asks the user to select one) or by reading the ticket form id and hard coding a value to it? Those are some ideas you could use