Jacqui1811
Programmer
Hy guys.
I have a few textboxes that need to be numerical.
The on blur event fires an isNumerical javascript function.
If the value is not numerical I show an alert box stating that the value needs to be numerical. Problem is that I want to return focus to that field and at the moment it just moves on to the next one.
Hope you can help. Code is below :
Here is the function.
<script language="javascript" type="text/javascript">
function isNumeric(textBox, boxName)
{
if(isNaN(textBox.value))
{
alert("The input needs to be numerical for field " + boxName);
textBox.focus();
return false();
}
}
</script>
Here is the calling code.
<asp:textbox id="txtNoEpisodes" size="2" maxlength="3" runat="server" onblur="isNumeric(this, 'txtNoEpisodes')"></asp:textbox>
Thanks in advance.
Jacqui
I have a few textboxes that need to be numerical.
The on blur event fires an isNumerical javascript function.
If the value is not numerical I show an alert box stating that the value needs to be numerical. Problem is that I want to return focus to that field and at the moment it just moves on to the next one.
Hope you can help. Code is below :
Here is the function.
<script language="javascript" type="text/javascript">
function isNumeric(textBox, boxName)
{
if(isNaN(textBox.value))
{
alert("The input needs to be numerical for field " + boxName);
textBox.focus();
return false();
}
}
</script>
Here is the calling code.
<asp:textbox id="txtNoEpisodes" size="2" maxlength="3" runat="server" onblur="isNumeric(this, 'txtNoEpisodes')"></asp:textbox>
Thanks in advance.
Jacqui