Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clicking submit clears file field instead of submitting the form (IE9)

I got a weird error I hope you guys can help with.

Sometimes when the user tries to submit a form the file upload field image just clears and nothing happens. I doesn't seems like the form get submitted at all.

Then the day after everything works fine. The error occurs on random days/times.

First I thought it was a problem with the users computer but this happens on two different computers the customer has. One of the computers has Windows 7 professional & Internet Explorer 9. I don't have the setup on the other one.

I have tried with Google Chrome, Firefox 6.0.2, Internet Explorer 9, 8 (browser compatibility mode), 7 (browser compatibility mode) on windows 7 home with no problems at all on my computer.

Here is the form:

<form action="/user/image" method="post" accept-charset="utf-8" class="form_default" enctype="multipart/form-data">
    <fieldset>
        <ol>
            <li>
                <button type="submit" name="save" value="submit" class="button">Save</button>
            </li>
            <li>
                <label for="image">Profile image</label><input type="file" id="image" name="image" />
            </li>
            <li>
                <button type="submit" name="save" value="submit" class="button">Save</button>
            </li>
        </ol>
    </fieldset>
</form>
like image 534
Cudos Avatar asked Sep 22 '11 10:09

Cudos


Video Answer


1 Answers

There should be only 1 submit button per form. So keep 1 save button as type="submit" ,change another to type="button"

like image 136
sweety123 Avatar answered Oct 12 '22 00:10

sweety123