locked
Best way to add text based on attribute value RRS feed

  • Question

  • Hello,

    We have a requirement to display a single line of text with some formatting (colors, bold etc) based on whether a particular attribute is true or false. If true we display this one line of text (the attribute itself is not displayed on the form). 

    Since they want the text in red, for example, and bold my inclination is to create an htlm webresource residing within an Iframe on the form. Forgot, they also will probably want some kind of icon next to the text like a flag or something.

    Is there a better way to achieve this? I can make it work but having it show dynamically based on an attributes value  - I am not sure of the javascript syntax for that. Also, my Iframe has the URL of html hard coded. If this was to move to another environment won't this be a problem?


    Robert

    Saturday, May 18, 2013 2:05 AM

Answers

All replies

  • Hello,

    To show or hide a field based on values of other fields have a look at this customization free JavaScript library. To change the background color of a field have a look at this or this link.



    My Weblog | My Website

    Saturday, May 18, 2013 4:21 AM
    Moderator
  • Thanks - probably wasn't clear -

    I don't want to show the field at all in question but instead if that attribute has a 'true' value display a static line of text with some formatting (ie bold font , colors etc).

    I can get the text to display calling an html webresource. Its the conditional part that I don't know the syntax for.  Right now I just have an I-frame calling the htlml webresource but I'm not sure how to make it display conditionally.

    THanks


    Robert

    Tuesday, May 21, 2013 1:33 PM
  • If you are using a web resource it means that you could use Xrm.Page references. Have a look at this link and undergoing nodes (specially the entity.data methods) to find your appropriate answer.


    My Weblog | My Website

    Tuesday, May 21, 2013 4:52 PM
    Moderator