最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - how to get selected value from a option set crm 4 dynamics 2011 online - Stack Overflow

programmeradmin4浏览0评论

This is a question related to using javascript with crm 4 2011 online

I created an optionset -status: open,closed and a onchange event handler that calls the function run with the context as parameter.

In js i tried the following and more:

function run(selectedItems)
{
    var s = selectedItems[0];
}

But i always get an undefined variable.

How can get the selected value from a optionset?

Thanks

EDIT:

i tried

function run() { 
alert("hello"); 
var texter = Xrm.Page.getAttribute("new_state_request").getSelectedOption().text; 
alert(texter); 
} 

just now. Gettin this: Error in userdefined event of this field. field:new_state_request event:onchange error:undefined

This is a question related to using javascript with crm 4 2011 online

I created an optionset -status: open,closed and a onchange event handler that calls the function run with the context as parameter.

In js i tried the following and more:

function run(selectedItems)
{
    var s = selectedItems[0];
}

But i always get an undefined variable.

How can get the selected value from a optionset?

Thanks

EDIT:

i tried

function run() { 
alert("hello"); 
var texter = Xrm.Page.getAttribute("new_state_request").getSelectedOption().text; 
alert(texter); 
} 

just now. Gettin this: Error in userdefined event of this field. field:new_state_request event:onchange error:undefined

Share Improve this question edited Jun 28, 2013 at 14:00 Guido Preite 15.1k5 gold badges37 silver badges67 bronze badges asked May 24, 2013 at 14:21 zirbelzirbel 4001 gold badge5 silver badges24 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 9

these are the right methods with an optionset attribute, for more information visit this link:

http://msdn.microsoft./en-us/library/gg334409.aspx

get the text of selected option

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

get the numeric value of selected option

Xrm.Page.getAttribute("fieldname").getValue();

try

To Get the selected text of a OptionSet field

Xrm.Page.getAttribute("CRMFieldName").getSelectedOption().text;

To Get the selected value of a OptionSet field

Xrm.Page.getAttribute("CRMFieldName").getSelectedOption().value;
发布评论

评论列表(0)

  1. 暂无评论