Recent searches


No recent searches

How do I change the description field text / help-text based on form type, and also has multi-language support?

Answered


Posted Apr 26, 2023

Hello,

We have the following requirements:

  1. Different forms need different titles / description sub-text in the description fields.
  2. The fields need to be internationalized based on the help-center language.

(2) is largely solved by leveraging the dynamic content system in Zendesk, however (1) cannot be. I saw some posts about injecting jquery into the help-center, but if I do that, then I break (2) since dynamic content can no longer be leveraged.

What is the way forward here?


0

1

1 comment

image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

Hi Raj Agarwal,

I think this code will be helpful for you:

  var htmllang = document.documentElement.lang;
  
  // Form One 
  if (htmllang === "en-US") {
  if(window.location.href.indexOf('00000')>0){
      document.querySelector('h1').innerText = "Title Name";
      document.querySelector('#request_description_label').innerText = "You Text Based On Different Forms";
    }
  } 


// Form Two
if (htmllang === "da") {
  if(window.location.href.indexOf('11111')>0){
      document.querySelector('h1').innerText = "Title Name";
      document.querySelector('#request_description_label').innerText = "You Text Based On Different Forms";
    }
  }

 

en-US - Language symbol

00000 - Form ID 

Title Name - Remove this title and write new one

You Text Based On Different Forms - Description field title, remove it and write yours

 

 

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post