- 注册时间
- 2016-6-2
- 最后登录
- 1970-1-1
- 阅读权限
- 10
- 积分
- 355
- 精华
- 0
- 帖子
- 92
 
|
如何所示,我要根据有害生物的值,来判断是虫害的话,虫口数量单元格允许编辑,病斑数单元格不可编辑
现在我的问题是,我页面加载时,我直接设置虫口数量跟病斑数单元格不可编辑,通过js来控制其允许编辑的时候报错,在 wpmcInput.setEnabled(true);提示Cannot read property 'setEnabled' of undefined,应该怎么表示呢
<div field="PestId" width="100" required="true" type="comboboxcolumn" headeralign="center" align="center">
林业有害生物
<input property="editor" id="PestName" name="PestName" class="mini-combobox" style="width: 100%;" textfield="DictionaryName" valuefield="DictionaryId" emptytext="林业有害生物"
url="../../AjaxService/MES_Ajax.aspx?method=GetPestType" showNullItem="true" />
</div>
<div field="WormNum" vtype="int" width="80" headeralign="center" align="center">
虫口数量
<input property="editor" Enabled="false" name="WormNum" id="WormNum" class="mini-textbox" style="width: 100%;" />
</div>
<div field="LesionTrunkNum" vtype="int" width="90" headeralign="center" align="center">
树干病斑数
<input property="editor" Enabled="false" id="LesionTrunkNum" name="LesionTrunkNum" class="mini-textbox" style="width: 100%;" />
</div>
<div field="LeafDiseasesId" type="comboboxcolumn" autoshowpopup="true" width="120" headeralign="center" align="center">
叶部病害比例
<input property="editor" class="mini-combobox" Enabled="false" id="LeafDiseasesId" name="LeafDiseasesId" style="width: 100%;" textfield="DictionaryName" valuefield="DictionaryId" emptytext="叶部病害比例"
url="../../AjaxService/MES_Ajax.aspx?method=GetProportionOfLeafDiseases" />
</div>
function Pestchanged(e) {
var PestId = mini.getbyName("PestName");
console.log(PestId);
$.ajax({
url: "../../AjaxService/MES_Ajax.aspx?method=GetPestNameType&DictionaryId=" + PestId.value,
cache: false,
success: function (text) {
var o = mini.decode(text);
var PestNameType = o[0].PestType;
//alert(PestNameType);
if (PestNameType == '0') {//虫害
var wpmcInput = mini.getbyName("WormNum");
wpmcInput.setEnabled(true);
alert(2);
var wpmcInput = mini.getbyName("LeafDiseasesId");
wpmcInput.setEnabled(true);
var wpmcInput = mini.getbyName("LesionTrunkNum");
wpmcInput.setEnabled(false);
var wpmcInput = mini.getbyName("BudsNum");
wpmcInput.setEnabled(false);
}
else if (PestNameType == '1') {
var wpmcInput = mini.getbyName("LesionTrunkNum");
wpmcInput.setEnabled(true);
var wpmcInput = mini.getbyName("BudsNum");
wpmcInput.setEnabled(true);
var wpmcInput = mini.getbyName("WormNum");
wpmcInput.setEnabled(false);
var wpmcInput = mini.getbyName("LeafDiseasesId");
wpmcInput.setEnabled(false);
}
}
});
}
|
|