Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] required entry field
- From: Michael_Dougherty at PBP.com (Michael Dougherty)
- Subject: [Javascript] required entry field
- Date: Wed Mar 26 16:15:07 2003
I'm thinking of VB/VFP's lostfocus() method which can return false to
prevent the loss of focus. Consider this scenario (which is closer to what
i'm doing)
<input name='CCExpireMonth' onBlur='validMonth(this)' />
<input name='CCExpireYear' onBlur='validYear(this)' />
function validMonth( obj ) {
if( <invalid>) {
alert("invalid month");
obj.select();
obj.focus();
}
}
function validYear( obj ) {
if( <invalid> ) {
alert("invalid year");
obj.select();
obj.focus();
}
}
After the object's BLUR, the method fires. Does this mean that during the
execution of the method that no control has focus? When the obj.focus()
statement is executed, will another onBlur be executed first or is there no
currently focused control to Blur at this point? (hopefully this question
is understandable, because it's late in the day <g>)
-----Original Message-----
From: javascript@xxxxxxxxxx [mailto:javascript@xxxxxxxxxx]
Sent: Wednesday, March 26, 2003 3:57 PM
To: javascript@xxxxxxxxxx
Subject: Re: [Javascript] required entry field
http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onblur.asp?
frame=true
According to MS, it does not cancel.
What do you mean by unpleasantry though? I would naturally think this
is how it would work since onBlur means it actually had a blur event
occur. So to cancel something that already happened would be pointless.
Now if there was an onbeforeblur (which there isn't), maybe it'd be
possible.
Chris Tifer
http://emailajoke.com
----- Original Message -----
From: "Michael Dougherty" <Michael_Dougherty@xxxxxxx>
To: <javascript@xxxxxxxxxx>
Sent: Wednesday, March 26, 2003 4:49 PM
Subject: RE: [Javascript] required entry field
>> OK, i have done plenty of 'work arounds' before...
>>
>> If this were the onSubmit method of a form, the "return false" syntax
WOULD
>> prevent the form submission, right? So what i'm seeing is an
inplementation
>> unpleasantry of the onBlur method?
>>
>> -----Original Message-----
>> From: javascript@xxxxxxxxxx [mailto:javascript@xxxxxxxxxx]
>> Sent: Wednesday, March 26, 2003 3:45 PM
>> To: javascript@xxxxxxxxxx
>> Subject: Re: [Javascript] required entry field
>>
>>
>> I would naturally think that once onBlur is called, it's going to lose
>> focus
>> no matter what. I would change the routine so that way it specifically
>> sets the focus back to that field instead of just trying to cancel the
>> onblur
>> event.
>>
>> Chris Tifer
>> http://emailajoke.com
>>
>>
>> ----- Original Message -----
>> From: "Michael Dougherty" <Michael_Dougherty@xxxxxxx>
>> To: <javascript@xxxxxxxxxx>
>> Sent: Wednesday, March 26, 2003 4:25 PM
>> Subject: [Javascript] required entry field
>>
>>
>> >> function isValid( checkValue ) {
>> >> return (checkValue!='')
>> >> }
>> >>
>> >> <input type='text' name='NeverBlank' value='' onBlur='return
>> >> isValid(this.value)' />
>> >>
>> >>
>> >> The idea is to prevent the user from exiting this field while it's
>> blank.
>> >> (OK, so this would be a user-hostile experience - it's just an
>example)
>> >>
>> >> What i'm seeing is that when the user hits TAB, the focus moves to
the
>> >> next field - regardless of the return value from isValid()
>> >>
>> >> Any thoughts?
>> >>
>> >> _______________________________________________
>> >> Javascript mailing list
>> >> Javascript@xxxxxxxxxx
>> >> https://lists.LaTech.edu/mailman/listinfo/javascript
>>
>> _______________________________________________
>> Javascript mailing list
>> Javascript@xxxxxxxxxx
>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>
>> _______________________________________________
>> Javascript mailing list
>> Javascript@xxxxxxxxxx
>> https://lists.LaTech.edu/mailman/listinfo/javascript
_______________________________________________
Javascript mailing list
Javascript@xxxxxxxxxx
https://lists.LaTech.edu/mailman/listinfo/javascript
- Prev by Date: [Javascript] required entry field
- Next by Date: [Javascript] select
- Previous by thread: [Javascript] required entry field
- Next by thread: [Javascript] required entry field
- Index(es):