solarisuser Posted August 13, 2007 Share Posted August 13, 2007 Hi All, I am having a tough time trying to figure out how to go about this... I would like to have the form submit when my <input type=text> field has five digits typed in. Any help would be most appreciated! Thanks Quote Link to comment Share on other sites More sharing options...
emehrkay Posted August 13, 2007 Share Posted August 13, 2007 I'm typing this o my phone, for give errors and cb stands for curly braces as I am unable to find them on this keyboard both your form and formfield needs unique ids. function fieldsubmit()cb var field = documentGetElemetById(fieldid); field.onkeyup = function()cb if(field.length greaterthan 5) documentGetElemetById(formid).submit(); cb cb lol it looks strage on my phone, I hope that it helps Quote Link to comment Share on other sites More sharing options...
php_tom Posted August 13, 2007 Share Posted August 13, 2007 Small bug: emehrkay's code will submit after 6 digits are typed. So it should be: function fieldsubmit() { var field = documentGetElemetById(fieldid); field.onkeyup = function() { if(field.length >= 5) documentGetElemetById(formid).submit(); } } BTW, this code will automatically submit after 5 CHARS are inputted, you should probably still check that they are digits... but that's just a detail. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.