if i may make a suggestion... you could simplify that by adding a class to each
of the form elements the using the $$ with invoke...
function validateFn(e){
console.log(e.target.value);
// assuming you use firebug
}
$$('.ClassName').invoke('observe', 'keyup', validateFn);
hopefully that gets you on the right track
-----Original Message-----
Date: Monday, June 01, 2009 5:37:48 pm
To: "Prototype & script.aculo.us" <[email protected]>
From: "molo" <[email protected]>
Subject: [Proto-Scripty] Cant get focus to work with change event when tabbing
out of input
I could use some help. I've been looking at this all day and cannot
come up with a solution
I am using the same routine on these 5 input fields. If I type in a
character on one of these fields and press enter, it works as expected
I get an error alert and focus on the field. However if I type in a
character and tab out of the field I get an alert error but the focus
is on the next field. I guess the blur event takes it to the next
field.
Can someone tell me what I need to do to get the focus working
correctly here
Here is my event related code
Event.observe('oldidratio','change',validateNumberChange);
Event.observe('cashpershare','change',validateNumberChange);
Event.observe('proration','change',validateNumberChange);
Event.observe('newid1ratioentry','change',validateNumberChange);
Event.observe('newid1fmv','change',validateNumberChange);
Here is the function
function validateNumberChange(){
var numericField = $F(this);
if(IsNumber(numericField,true)){
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---