MWF.xDesktop.requireApp("process.Xform", "$Input", null, false); MWF.require("MWF.widget.UUID", null, false); /** @class Radio 单选按钮。 * @example * //可以在脚本中获取该组件 * //方法1: * var field = this.form.get("fieldId"); //获取组件对象 * //方法2 * var field = this.target; //在组件本身的脚本中获取,比如事件脚本、默认值脚本、校验脚本等等 * * var data = field.getData(); //获取值 * field.setData("字符串值"); //设置值 * field.hide(); //隐藏字段 * var id = field.json.id; //获取字段标识 * var flag = field.isEmpty(); //字段是否为空 * field.resetData(); //重置字段的值为默认值或置空 * @extends MWF.xApplication.process.Xform.$Input * @o2category FormComponents * @o2range {Process|CMS|Portal} * @hideconstructor */ MWF.xApplication.process.Xform.Radio = MWF.APPRadio = new Class( /** @lends MWF.xApplication.process.Xform.Radio# */ { Implements: [Events], Extends: MWF.APP$Input, /** * @ignore * @member {Element} descriptionNode * @memberOf MWF.xApplication.process.Xform.Radio# */ loadDescription: function(){}, _loadNode: function(){ if (this.readonly || this.json.isReadonly ){ this._loadNodeRead(); }else{ this._loadNodeEdit(); } }, _loadNodeRead: function(){ this.node.empty(); this.node.set({ "nodeId": this.json.id, "MWFType": this.json.type }); var radioValues = this.getOptions(); var value = this.getValue(); if (value){ var texts = ""; for (var i=0; i{"value": ["male"], "text": ["男"]} * {"value": [""], "text": [""]} * * @example * var data = this.form.get('fieldId').getTextData(); * var text = data.text[0] //获取选中项的文本 */ getTextData: function(){ var inputs = this.node.getElements("input"); var value = ""; var text = ""; if (inputs.length){ for (var i=0; i