Ticket #3956 (closed bug: invalid)
serializeArray() return a empty array
| Reported by: | ElGigi | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.3.2 |
| Component: | ajax | Version: | 1.3.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
In little form serializeArray() work. But when tu form is big, serializeArray() return a empty array.
var data = $("#form :input");
data = data_temp.serializeArray();
First line, inputs are here well. Second line, the array returned is empty.
Change History
comment:1 in reply to: ↑ description Changed 4 years ago by pbcomm
comment:2 Changed 4 years ago by ElGigi
Sorry for the bad copy/paste, the good code is :
var data = $("#form :input");
data = data.serializeArray();
comment:3 Changed 4 years ago by ElGigi
I try to find the origin of the bug.
It's the filter part of the serializeArray function :
.filter(function(){
return this.name && !this.disabled &&
(this.checked /select|textarea/i.test(this.nodeName) /text|hidden|password/i.test(this.type));
})
If i take off "!this.disabled", it's work well.
But it's appear that the filter part of serializeArray function is the same than 1.2.6. But filter function has changed...
comment:4 Changed 4 years ago by dmethvin
Does this happen in all browsers, or just one particular browser? Also, how big does the form need to be before the problem appears? Can you attach an example of a large form that doesn't work?
comment:5 Changed 4 years ago by ElGigi
Ok, you can close the bug ;).
My problem was : 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.
All inputs were disabled with the selector [@attr] and so jQuery 1.3 return 0 inputs. Sorry for the wrong alert.
But i suggest to return 0 element when the selector is [@attr].
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Where is data_temp being declared in your example?
data_temp is empty at this point, so is the result from serializeArray().
Replying to ElGigi: