By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,408 Members | 1,624 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,408 IT Pros & Developers. It's quick & easy.

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

P: n/a
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="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
back.

Kind regards

Dave

Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.