Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Web Design, HTML And CSS Forums (http://www.go4expert.com/forums/web-design-forum/)
-   -   event handling problems (http://www.go4expert.com/forums/event-handling-problems-t1923/)

prashantSum 17Nov2006 18:53

event handling problems
 
hi all,
Our application uses client side validation, previously they have written similar validation code for all input controls in HTML. In the 'onblur' event of an input control, it checks if it is a required field and shows a 'x' cross image beside the control.

So, now the problem is with the file control.

when the user clicks on the 'browse' button the cross mark is appearing beside the input file control, even before the user's action of selecting a file is completed ( the browse window is still open) so it looks awkward.

Now want we want is, when the user clicks on the 'Browse' button we don't want to do validation, and when the user just pass away from the control by using tab (or mouse), we want to show the cross image (i.e. validation)

but when I tried to trace the event, on both occasions I am getting 'onblur' event.
when the user clicks on the 'Browse' button, first 'onblur' is getting called and then 'onclick', so I am unable to distinguish these two cases.

So is there any way out, I have few points in mind
1) can I know (with some property or event handling mechnism) when the user clicks on the 'browse' and when he just passes away from the control
2) or can we have access to event queue of IE, my view is, in the second case when the use clicks on the 'browse...' button 'onblur' and 'onclick' is getting called one after the other, so if in 'onblur' event if we are able access the event queue and know that 'onclick' is in the queue then we can make it.
???
help please.....

pradeep 18Nov2006 11:00

Re: event handling problems
 
Try using the onchange event for file upload field.

prashantSum 21Nov2006 11:03

Re: event handling problems
 
thx for the reply pradeep,

I can use 'onchange' but this will not fire validation when the user passes away from the file control (I mean cursor coming into control and then goes out of the control).


All times are GMT +5.5. The time now is 00:22.