After upgrading to RadControls for ASP.NET ( not ASP.NET AJAX ) my client-side validation does not perform properly. The code below puts the function into an infinite loop.
function ValidateLongitude(sender, args)
{
var newValue = String(args.NewValue);
if( newValue.charAt(0) != '-' )
{
newValue = '-' + newValue;
sender.SetValue(newValue);
}
if( newValue.length >= 4 && newValue.indexOf('.') < 0 )
{
if( newValue.substring(0,4) < -520 )
{
newValue = newValue.substring(0,3) + '.' + newValue.substring(3);
}else{
newValue = newValue.substring(0,4) + '.' + newValue.substring(4);
}
sender.SetValue(newValue);
}
if( newValue != '' && (newValue > -52 || newValue < -142 ))
{
sender.SetValue('');
}
}
Given the code below does not cause an infinite loop, can you explain why Telerik is calling the OnValueChanged every time we try to set the text box to a new value?
<html>
<head>
<script>
function BlurIt()
{
var x = document.getElementById("txtID");
x.value = "new value";
}
</script>
</head>
<body>
<form>
<input type="text" id="txtID" onblur="BlurIt();">
</form>
</body>
</html>
And upgrading to Asp.net AJAX is not option.
function ValidateLongitude(sender, args)
{
var newValue = String(args.NewValue);
if( newValue.charAt(0) != '-' )
{
newValue = '-' + newValue;
sender.SetValue(newValue);
}
if( newValue.length >= 4 && newValue.indexOf('.') < 0 )
{
if( newValue.substring(0,4) < -520 )
{
newValue = newValue.substring(0,3) + '.' + newValue.substring(3);
}else{
newValue = newValue.substring(0,4) + '.' + newValue.substring(4);
}
sender.SetValue(newValue);
}
if( newValue != '' && (newValue > -52 || newValue < -142 ))
{
sender.SetValue('');
}
}
Given the code below does not cause an infinite loop, can you explain why Telerik is calling the OnValueChanged every time we try to set the text box to a new value?
<html>
<head>
<script>
function BlurIt()
{
var x = document.getElementById("txtID");
x.value = "new value";
}
</script>
</head>
<body>
<form>
<input type="text" id="txtID" onblur="BlurIt();">
</form>
</body>
</html>
And upgrading to Asp.net AJAX is not option.