我有一个函数,我已编码为在特定选择没有值时抛出错误消息。我遇到的问题是我有环境(当从Netbeans运行时)看到这个html值很好并且有效但是当它在服务器上时它没有看到html并且给出值“”并且不起作用正确。任何帮助赞赏因为我很难过。
这是JavaScript:
function CheckForm(obj, optMsgDiv) {
if(obj != "") {
return true;
} else {
if(optMsgDiv != "") {
var messageObj = document.getElementById(optMsgDiv);
var clearObj = document.getElementById('refUpdMethod').value;
alert("value: " + clearObj + " Obj: " + obj);
if(clearObj != "") {
//goes to this part of the code on my local
return true;
} else {
//goes this part of the code hosted on the server
var message = getErrorMsg();
DisplayErrorMessage(clearObj, messageObj, message);
}
}
}
return false;
}
这是HTML:
<macsweb:button label="<< Close >>" updModeAction="if(CheckForm '${refUpdMethod}','messages_container${counter}${refUpdate.CASE_REFERENCE_UPDATE_SEQ_NBR}') == false)return false;if(recordList.checkList()==false)return false;else{recordList.clearList('${parentDiv}'); temp = validateBeforeSubmit('${closeUrl}?action=c','${divID}','${closeMessage}','','','true','',document.forms['frmRefUpdateBilling${counter}${refUpdate.CASE_REFERENCE_UPDATE_SEQ_NBR}'],'Y','','messages_container${counter}${refUpdate.CASE_REFERENCE_UPDATE_SEQ_NBR}');
if(temp)disableSingleField(this);}"
style="font-weight: bold; display:${(sessionScope.aBean.updatesCloseStatus > 1) ? '' : 'none'}"
/>
<td align="right">Method Used </td>
<td>
<select id="refUpdMethod" name="refUpdMethod" >
<c:forEach items="${refUpdateBean.validMethods}" var="eaMethod">
<option value="${eaMethod}" ${(refUpdate.REFERENCE_UPDATE_METHOD eq eaMethod) ? 'selected' : ' '} >${eaMethod}</option>
</c:forEach>
</select>
<macsweb:dumpOriginalValues fieldName="refUpdMethod" fieldValue="${refUpdate.REFERENCE_UPDATE_METHOD}" />
</td>