Recent searches


No recent searches

How to auto populate the content of Description

Answered


Posted Jul 22, 2021

Dear All,

I am able to set auto populate the content for Subject by below script but unsuccessful for Description. Would you please help me. I was stuck here few days already. I am not sure what is wrong with it.

The end-user interface as below.

The script.js as below.


1

11

11 comments

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

0


image avatar

Trapta Singh

Zendesk LuminaryCommunity Moderator

Hi @...,

Try replacing your code to set value for description with the below code.

tinymce.get("request_description").setContent("<p>Test</p>");

Let me know how it goes for you.

Thanks

1


Dear Trapta,

It works. Tks very much. 

Btw may I consult with you how to change the the font color for substring in the Subject and Description?

Rgds

Tan Bing

0


image avatar

Trapta Singh

Zendesk LuminaryCommunity Moderator

@...,

If the colour is not conditional then you can use the CSS. If it is conditional then you can use the below code to make the changes.

$('#request_subject').style.color = 'red';
tinymce.get("request_description").getWin().document.body.style.color = 'blue';

Let me know if this solves the purpose.

Thanks

0


HI Trapta,

Tks for your advice first. 

I am able to change entire string color as below attachment. But i wish to change XXXXXXX substring portion as RED and others keep as BLACK. How will able to achieve it?

0


image avatar

Trapta Singh

Zendesk LuminaryCommunity Moderator

@...,

I don't think it will be possible for the subject field, however, for the description field, you must be passing the HTML in the setContent() function. You can simply put the class to wrap the XXXX text in the description field and then using

tinymce.get("request_description").getWin().document.getElementByClassName('CLASS_NAME').style.color = 'green';

you can change the colour of the particular substring.

Let me know if you face any issue.

Thanks

1


Hi Trapta,

May I check with you how do we define a class in script.js? Can share some example for it? 

0


Hi Trapta,

I have resolved it by HTML format. Tks for your help.

May I just confirm with you if it is not possible to change substring color in Subject field?

0


image avatar

Trapta Singh

Zendesk LuminaryCommunity Moderator

@..., I don't think it will be possible to change the substring colour in the subject field as it's an input field and uses string only not HTML content.

You can only change the colour of the whole string in the subject field and not just substring.

Thanks

0


Hi Trapta,

Tks very much for your help.

0


image avatar

Trapta Singh

Zendesk LuminaryCommunity Moderator

Glad to hear that I could help. Happy Zendesking :)

0


Post is closed for comments.

Didn't find what you're looking for?

New post