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

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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

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.


<input name="userfile" type="file" id="filetoupload1"
onMouseUp="alert('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

Kind regards


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


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.



Site Timeline