![]() |
moving focus on maxlength
Hi i have this working but i have some quesitons.
First is this up to current standards. Second what is the standard action when you get to the end of this group. a. leave it on the last input focus for this group b. focus back on the first input in case they want to start over. c. move to the next input after this group and stop. i am seperating the ip input into 4 sections. I will tie then together later. Code:
Thanks :) |
Well, I normally find code like this horribly annoying, so I wouldn't do any of the above.
I *hate* it when form code automatically moves me to the next field. What happens if I made a mistake? What a pain to have to use the mouse to get back to the field and then carefully REMOVE the mistake before entering the correction. So inflexible. Maybe I want to add a letter at then end and *THEN* remove a character in the middle. With this kind of annoying crap I can't do that. HAVING SAID ALL OF THAT... I'm unaware of any "standard" in this area. But I would *assume* you'd just keep on going to the next input field. Your "groups" are artificial, anyway, so why make them more significant than they are? Besides, if you do otherwise, then the user must use the mouse (or hit TAB several times) to get to the *correct* next field. |
By the by, you could get rid of those useless id's in the fields, you know.
Code:
function moveMax(pfield,nfield) |
Thanks, yes i find them annoying was well most of the time, but for certain inputs such as a long game license codes like
QF98-F4S7-GSZ7-FEE7-FA4F as well as IP address and SSN i do find it handy, that way i can just look at the data to input and just go for it. It is also a pain to have to type such a long game code and have to move the mouse from section to section cause many games split this up like i did and then you have to mess with the mouse to go field to field as well if i took this away. Its like 6 of one, half dozen of another... No way to make all of us happy ya know :) I do not use this on every field. Just those mentioned above. Also i had to make myself get into the habbit of doing id's in inputs wether i needed them or not, because i do use them quite a bit in js for validation of input and it is easier to have them in there and do nothing sometimes than it is to have to go back and add them if i need them. Thanks so much for your help :) as well as the improvment of the function :) |
Quote:
Compare this code (just showing the code needed to access four form fields, no validation): Code:
var fld1 = document.getElementById("field1");Code:
var form = document.getElementById("myForm");What's the excuse for using IDs? |
Quote:
|
| All times are GMT +1. The time now is 10:58 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.