Randell's Tech Blog

Randell's Tech Blog


Error: Form elements must not be named “submit”.

Posted: 30 Jul 2009 03:28 AM PDT

I recently encountered a jQuery alert error that says

Error: Form elements must not be named "submit".

It appears when submitting a jQuery upload form using ajaxForm() The weird thing is that I didn’t have any form elements with the name submit.

So I took on the quest of finding where the error is coming from.

Inspecting the *.js files that my component is using revealed line 54 of the jquery.form.js file which contains

$(':input[@name=submit]', form).length

From API/1.3/Selectors, it says that

Note: In jQuery 1.3 [@attr] style selectors were removed (they were previously deprecated in jQuery 1.2). Simply remove the ‘@’ symbol from your selectors in order to make them work again.

I probably got the problem when I replaced my jQuery version from 1.2 to 1.3. Now, I either have to modify that line to remove the @ symbol or replace my version of jquery.form.js.

Related posts:

  1. Using jQuery on a generic registration form
  2. CodeIgniter: AJAX Pagination

Tags: , , , , , , , ,

0 comments: