如何从选项集crm 4 dynamics 2011在线获得选定的价值 [英] how to get selected value from a option set crm 4 dynamics 2011 online
问题描述
这是一个与在线使用jm 4 2011相关的问题
This is a question related to using javascript with crm 4 2011 online
我创建了一个选项集-status:open,closed和一个调用函数的onchange事件处理程序以上下文作为参数运行。
I created an optionset -status: open,closed and a onchange event handler that calls the function run with the context as parameter.
在js中我尝试了以下内容:
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?
谢谢
编辑:
我试过
function run() {
alert("hello");
var texter = Xrm.Page.getAttribute("new_state_request").getSelectedOption().text;
alert(texter);
}
刚才。 Gettin this:
此字段的userdefined事件出错。
字段:new_state_request
事件:onchange
错误:未定义
just now. Gettin this: Error in userdefined event of this field. field:new_state_request event:onchange error:undefined
推荐答案
这些是正确的具有optionset属性的方法,有关更多信息,请访问此链接:
these are the right methods with an optionset attribute, for more information visit this link:
http://msdn.microsoft.com/en-us/library/gg334409.aspx
获取所选选项的文本
Xrm.Page.getAttribute("fieldname").getText();
获取所选期权的数值
Xrm.Page.getAttribute("fieldname").getValue();
这篇关于如何从选项集crm 4 dynamics 2011在线获得选定的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!