How to auto populate the content of Description

11 Comments

  • TAN BING

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

    0
  • Trapta Singh
    Community Moderator

    Hi TAN BING,

    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
  • TAN BING

    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
  • Trapta Singh
    Community Moderator

    TAN BING,

    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
  • TAN BING

    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
  • Trapta Singh
    Community Moderator

    TAN BING,

    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
  • TAN BING

    Hi Trapta,

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

    0
  • TAN BING

    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
  • Trapta Singh
    Community Moderator

    TAN BING, 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
  • TAN BING

    Hi Trapta,

    Tks very much for your help.

    0
  • Trapta Singh
    Community Moderator

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

    0

Please sign in to leave a comment.

Powered by Zendesk