event handling problems

Discussion in 'Web Design, HTML And CSS' started by prashantSum, Nov 17, 2006.

  1. prashantSum

    prashantSum New Member

    Joined:
    Oct 24, 2005
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    0
    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.....
     
    Last edited: Nov 17, 2006
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    Try using the onchange event for file upload field.
     
  3. prashantSum

    prashantSum New Member

    Joined:
    Oct 24, 2005
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    0
    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).
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice