This may or may not work, but it is worth a shot.
Use the onChange() event handler of the text box you are leaving. Here is
an example:
<cfinput type="text"
name="myName" required="Yes"
Value="hello" size="20" maxlength="40"
message="CFUG Toronto is the Best User Group Anywhere"
onChange="validate(this)">
In your script tag, or script file, include a function like this
function setFocus(what) {
what.focus();
}
Then in your validation function, reset the focus like this:
setFocus(formElement);
I have not tested this code, but the general concept might work.
*********************
Within a form I am using JavaScript to validate <input
type=text> fields as soon as the user leaves the field.� This
is accomplished by calling the onblur event handler on
every text field in the form.� I want to be able to call the
focus() method to place the cursor back to a�field that just
lost focus, if the validation failed.��The problem is that this
can lead to an infinite loop since calling the focus() method
will invoke the onblur event for the next field�in the form (it
received focus by the user pressing TAB or mouse-clicking
the field).
method before calling focus() to transfer focus to the field
that failed validation.
Has this worked for anyone -- unfortunately calling blur() in
my JavaScript still triggers the onblur�event after I�move the
cursor with an explicit focus() call.
Thanks for any insight.
---------------
-
You are subscribed to the CFUGToronto CFTALK ListSRV.
This message has been posted by: [EMAIL PROTECTED]
To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)