onfocus()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ajaymohank
    New Member
    • Jan 2008
    • 29

    onfocus()

    Hello friends........ .

    In my project i use 2 textfields(name and designation). both the text fields should enter only letters and no numbers should be enterd. i wrote the function for it and i called it in the onBlur function of the textfields. but the problem is that if i enter any number or simply press the tab button it shows the alert message" invalid entry" and it keeps on goin in the loop. i have to press ctrl+alt+del to terminate the pgm.. if i change the on blur to onchange it works fine, but the focus function is not working....

    Code:
    function isAlphabetic(val)
    {
    
    if (val.value.match(/^[ a-zA-Z.]+$/))
    	{
    		return true;
    	}
    	else
    	{
    		alert("hi Invalid Entry");
    		val.focus();
    		return false;
    	}
    
    }
    thanks..
    Last edited by Markus; Oct 14 '08, 10:52 AM. Reason: added # tags
  • TheServant
    Recognized Expert Top Contributor
    • Feb 2008
    • 1168

    #2
    Where is your code which has the onblur/onchange? Also use the correct code tags for your post.

    Comment

    Working...