web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Not able to break a label in two line in ms crm 2016

(0) ShareShare
ReportReport
Posted on by

Hi guys , 

I need to break a label in two line . For this I added a javascript function and calling a formLoad event.

some times  it shows for a sec and vanishes. I m using ms crm 2016 on line.

**********************************************----------------------------------------------------------*************************************

function funsetLabel()
{
message = "first message" + '<br/>';
message = message + "second message";
var k = window.parent.document.getElementById("accen_field2_cl")
if(k == null)
{
alert("kk");
}
else
{
window.parent.document.getElementById("accen_field2_cl").innerText = message;

k.innerText =message;   
k.isContentEditable = true;
alert("tttttttt");  // working

window.parent.document.getElementById("accen_field2_cl").style.background="red"; // this is working
}

********************************************-----------------------------------------------------------**********************************

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Aiden Kaskela Profile Picture
    19,696 on at

    Hi,

    You should look at other ways to handle this because what you're doing isn't supported and could break with any update. For example, move the labels above the control so they have more space (a property of the Section), shorten the label, or hide the label and show it as a section name.

    There is a supported method called "selLabel" that you should try instead of the inner text. You may have the same issues but it'll be supported and less likely to break. Here are details on that:

    msdn.microsoft.com/.../gg334266.aspx

    Hope this helps! I'd appreciate if you'd mark this as Answering your question.

    Thanks,

     Aiden

  • ashlega Profile Picture
    34,477 on at

    Hi,

    please have a look at Aiden's response - it's probably a better way to handle this..

    But, if you do need something very custom, try using an iframe instead. For example, add a section with 2 columns - use the first column for an iframe and the second column for the actual field. Display your label in the iframe, and configure the field not to display any label at all. Whatever you do in the iframe will still be "supported" (more exactly, CRM won't really care about what you are doing there)

    If you need less space for the iframe, make it a 3 column section, for example.. then display iframe in the first one, and use the other two to display the field..

  • Suggested answer
    Dynamics_Alok Profile Picture
    1,746 on at

    Please set innerHTML in place of innerText because <br/> has no meaning in text.

    window.parent.document.getElementById("accen_field2_cl").innerHTML = message;

    Hope it would work for you.

    Happy CRMing

  • Community Member Profile Picture
    on at

    sorry for late reply

    I guess it is working because on loading of form first it display the newly assigned value 

    but suddenly it get change to its original value. Also break is not doing its work .

    Any suggestion ?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans