Ajax Form Issue: form elements must not be named submit

Permalink
Hi there,

I'm using the ecommerce plugin, and needed a way for users to be able to upload files as part of an order. I tried using the filemanager but didn't really get anywhere with it for guest users; I could upload the file (receiving an 'authorID can't be null' message when doing so), but on selecting the picture I would just see 'Access Denied'.

So I created my own attribute based on the original file upload attribute, yet I am running into some issues when implementing it. If I attempt to submit the form, I get the error message 'form elements must not be named submit'. I researched into it and found that it is a problem with the jQuery form plugin apparently when using a file upload in the same form. The only solution I have found, has been people saying to change the name of the submit value to something other than 'submit'; however when I do this, on submitting the form the address it tries to reach is 'about::blank'.

I'm at a bit of a loss at what to do, so wondered if anyone had come across a similar issue before and knows how I might tackle it best?

Cheers,

Dan

 
Danives replied on at Permalink Reply
I've managed to actually solve the issue by upgrading the jquery.form plugin to the latest version, and putting in some javascript to change the name, and ID, of the submit to something completely different.

I also had to ignore the $data parameter and just use the $_FILES e.g.

public function validateForm($data) {
   return (isset($_FILES['custom-image']['tmp_name']));
}


I believed the file data was being put in the $data parameter, whereas it was in fact empty on the image upload.

Been racking my brains on that one for a while now! Glad its done!!
chrisjterrell replied on at Permalink Reply
chrisjterrell
I had the same issue with the composer... thanks for the post