1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

event handling problems

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

  1. prashantSum

    prashantSum New Member

    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

    Try using the onchange event for file upload field.
  3. prashantSum

    prashantSum New Member

    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