Forum Moderators: open

Message Too Old, No Replies

2 forms on 1 page - file upload + send to mail

Different behavior in IE6 and Firefox 2

         

Darkelve

12:45 pm on Feb 5, 2007 (gmt 0)

10+ Year Member



I've got a problem with an ajax contact form I'm making.

It takes some input fields and also gives users the oppurtunity to include an attachment.

The way it's currently set up, is that first the user will (or won't) upload an attachment, which gets uploaded to the server and the path is stored in a variable. Then the user sends the filled-in form and the form fields are reformatted and sent to a mail address. In the e-mail, the user sees a link to the (location of the) attachment on the server so they can pick it up there.

However, this seems to work differently in Internet Explorer (6.0) and Firefox (2.0):

- With Internet Explorer, the method wors if you browse to the file, and immediately press the "Submit" button, but not if you first press the "Upload (Attachment)" button. Then the input fields get blanked and nothing happens after you fill in the forms again.

- With Firefox, it works if you first use the "Upload (attachment)" button, but if you press the "Submit" button then the form gets sent *without* the attachment getting uploaded

Any help appreciated.

rocknbil

8:11 pm on Feb 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm a little confused as to why you have two forms - and your users might be also. I would suggest using ONE form, attachment optional. The way you would manage this is your back-end script would process the upload **if** it exists and attach it to the mail. If the uploaded file doesn't exist, it doesn't attach a file, simple as that. This leaves the vistor with one form to submit.