input type file - javascript prevents dialog showing - any ideas why?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave Smithz

    input type file - javascript prevents dialog showing - any ideas why?

    OK, not strictly a PHP problem I guess but it occurred in my PHP project and
    I could not find a suitable Javascript NG (under pressure, already extended
    deadline.

    I user a "file" input type on a form. Therefore when the user presses browse
    a select file dialog appears.
    I wanted to have a javascript message reminding the user to press "Add
    Attachment" after selecting the file.

    Therefore:

    <input name="userfile" type="file" id="filetouploa d1"
    onMouseUp="aler t('Remember to press \'Add Attachment\' after selecting the
    file.'); return true;" />

    However, If I have this the file dialog does not appear. I tried playing
    around with the return value to no avail.

    I tried a different event onChange, and everything seemed fine. Until I
    tried manually typing into the text box and then the alert message just kept
    on popping up whatever I done on the form unless I pressed browse again and
    selected a different file.

    Any idea what is going on here?

    For now I have taken out the javascript but it will be very handy to put
    back.

    Kind regards

    Dave



  • Dave Smithz

    #2
    Re: input type file - javascript prevents dialog showing - any ideas why?

    Errr,

    Actually Onchange seems to work now. There must have been some little bug
    occuring or something. Before if I used on change and typed into the text
    box, it repeatedly flashed up the alert message. But now seems OK.

    Sorry to waste anyones time.

    Regards

    Dave


    Comment

    Working...