none
CRM 2011 Rollup 8 Problem for Xrm.Page.getAttribute("attributeName").getSelectedOption().text

    Question

  • I have problem after the CRM 2011 rollup update related to the javascript to get the text value of the optionset. Here is what I am using to get the text of the optionset

    Xrm.Page.getAttribute("attributeName").getSelectedOption().text

    As you can see in the above code, that I have used what is mentioned in the CRM 2011 SDK said to get the text value of the optionset. but now it is said that .text is will create problem browsers other then IE. what I need to change so that it will have not issue in any other browswer.

    waiting for your response as quickly as possible.

    and thanks in advance.


    Please mark the replies as answers if they help. Asim Sajjad Software Engineer http://asimsajjad.blogspot.com

    Wednesday, June 27, 2012 4:29 AM

Answers

  • I need to get the selected option text not simply the text. and it is provided by MS CRM 2011 SDK

    Please mark the replies as answers if they help. Asim Sajjad Software Engineer http://asimsajjad.blogspot.com

    But getText does return selected text. 

    getText

    Returns a string value of the text for the currently selected option for an optionset attribute.

    Attribute Types: optionset

    • Marked as answer by Asim Sajjad Thursday, June 28, 2012 8:29 AM
    Wednesday, June 27, 2012 4:46 PM

All replies

  • From the api document http://msdn.microsoft.com/en-us/library/gg334409

    The correct way of getting text from optionset is 

    Xrm.Page.getAttribute("attributeName").getText();

    • Proposed as answer by pogo69 Thursday, June 28, 2012 5:47 AM
    Wednesday, June 27, 2012 5:20 AM
  • What gave you the impression that .getSelectedOption().text will not be supported in browsers other than IE?  I have seen no reference to such in postings related to the impending multi-browser support.

    If your code adheres to the supported Xrm.Page object model (which this does) it should continue to work after the application of RU9 and via any supported browser.


    --pogo (pat) @ pogo69.wordpress.com

    Wednesday, June 27, 2012 5:22 AM
  • I have used one of the tool which is provided by the MS "microsoft dynamics crm 2011 custom code validation tool" to validate the javascript and it identify the .text will create problem other then IE that is why I have posted here to know something about it. As tool is  MS and code which I have used also code which is provided in the MS CRM 2011 SDK

    you can get control from here


    Please mark the replies as answers if they help. Asim Sajjad Software Engineer http://asimsajjad.blogspot.com

    Wednesday, June 27, 2012 9:27 AM
  • I need to get the selected option text not simply the text. and it is provided by MS CRM 2011 SDK

    Please mark the replies as answers if they help. Asim Sajjad Software Engineer http://asimsajjad.blogspot.com

    Wednesday, June 27, 2012 9:29 AM
  • Hi Asim Sajjad, Not completely on topic. But the tool you've used "Custom Code Validation Tool" isn't working, after a successful import... I started a post for it, but maybe you can point me out to something? http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/ccbdfc7e-a5eb-4b2e-ab16-f0cf804d819e

    Thank you in advance


    Wednesday, June 27, 2012 2:43 PM
  • I need to get the selected option text not simply the text. and it is provided by MS CRM 2011 SDK

    Please mark the replies as answers if they help. Asim Sajjad Software Engineer http://asimsajjad.blogspot.com

    But getText does return selected text. 

    getText

    Returns a string value of the text for the currently selected option for an optionset attribute.

    Attribute Types: optionset

    • Marked as answer by Asim Sajjad Thursday, June 28, 2012 8:29 AM
    Wednesday, June 27, 2012 4:46 PM
  • I have used one of the tool which is provided by the MS "microsoft dynamics crm 2011 custom code validation tool" to validate the javascript and it identify the .text will create problem other then IE that is why I have posted here to know something about it. As tool is  MS and code which I have used also code which is provided in the MS CRM 2011 SDK

    you can get control from here

    Thanks Asim.  I was aware of the Tool; I just haven't got around to using it yet.

    I'm very surprised (disappointed) that there is something in the supported Xrm.Page object model, published in the SDK, that will fail in the future release.


    --pogo (pat) @ pogo69.wordpress.com

    Thursday, June 28, 2012 1:22 AM
  • Yes and there is no replacement mean what to use instead of .text for getting selected option text

    Please mark the replies as answers if they help. Asim Sajjad Software Engineer http://asimsajjad.blogspot.com

    Thursday, June 28, 2012 4:25 AM
  • But there is a valid alternative.  Wei Ma has given you the answer; I believe you have misinterpreted its meaning.

    --pogo (pat) @ pogo69.wordpress.com

    Thursday, June 28, 2012 5:48 AM
  • Hi again Asim,

    Have a quick read through the following blog posting:

    http://pogo69.wordpress.com/2012/07/02/crm-2011-custom-code-validation-tool-ur9-aka-r8-preparation/

    It is my strong belief that the code you posted is a "false positive".  That is; while it may have been flagged as unsupported on browsers other than IE, it will continue to function correctly after the application of RU9 (AKA R8).

    I remain quite confident that as long as your code adheres to the supported Xrm.Page object model published in the SDK it will continue to work after RU9.


    --pogo (pat) @ pogo69.wordpress.com

    Monday, July 02, 2012 6:00 AM