[英]to disable required field validator
this is my javascript code here i am unable to disable the textbox(id="due_Date")
when i get the zero or negative amount in text feild (id="subtotal_input")
...any help would be appreciated.... 这是我的JavaScript代码,当我得到文本字段
(id="subtotal_input")
的零或负数时,我无法禁用textbox(id="due_Date")
(id="subtotal_input")
...任何帮助将不胜感激。
<script>
window.onload = function()
{
document.getElementById('subtotal_input').onchange = disablefield;
document.getElementById('phone_no').onchange = disablefield;
document.getElementById('phone_yes').onchange = disablefield;
}
function disablefield()
{
if ( document.getElementById('subtotal_input').value <= 0 )
{
document.getElementById('due_Date').value = '';
document.getElementById('due_Date').disabled = true
}
if ( document.getElementById('phone_no').checked == true )
{
document.getElementById('ReturnDate').value = '';
document.getElementById('ReturnDate').disabled = true}
else if (document.getElementById('phone_yes').checked == true ){
document.getElementById('ReturnDate').disabled = false;
}
}
You can use ValidatorEnable(validator, enable)
to enable or disable a validator. 您可以使用
ValidatorEnable(validator, enable)
启用或禁用验证器。
You can use something like this: 您可以使用如下形式:
objValidator = document.getElementById("<%=YourRequiredValidatorID.ClientID %>");
objValidator.enabled = true; //'true' if you want to enable else 'false'
ValidatorUpdateDisplay(objValidator);
Let me know if it works for you! 请让我知道这对你有没有用!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.