Bug Tracker

Opened 10 years ago

Closed 10 years ago

#12264 closed feature (wontfix)

Allow users customize the return obj in the serializeArray

Reported by: [email protected] Owned by:
Priority: low Milestone: None
Component: ajax Version: 1.8.0
Keywords: 1.9-discuss Cc:
Blocked by: Blocking:


I propose to accept a callback function in the serializeArray, so that the users can customize or filter the returning object.

For example:

  return {label:elem.name, value:val, type:elem.type};

This produces the following data structure:

[{label: "a", value: "1", type: "text"},
 {label: "b", value: "2", type: "text"},
 {label: "c", value: "3", type: "hidden"},

Or more powerful one:

  var $elem = jQuery(elem);
    return null;
  else if($elem.is(':date')){
    return {name:elem.name, value: mySpecialDateFormat(val)};
  else if($elem.is(':hidden')){
    mySpecialMethodToHandleHiddenInput(elem.name, val);
  return {name:elem.name, value:val};

Change History (9)

comment:2 Changed 10 years ago by timmywil

Component: unfiledajax
Keywords: 1.9-discuss added
Priority: undecidedlow
Status: newopen
Version: 1.8.0

comment:3 Changed 10 years ago by dmethvin

Type: enhancementfeature

Bulk change from enhancement to feature.

comment:4 Changed 10 years ago by gibson042

-1, this seems much better suited to a plugin.

comment:5 Changed 10 years ago by mikesherov


comment:6 Changed 10 years ago by Rick Waldron

-1, Monkey patch it

comment:7 Changed 10 years ago by gibson042


comment:8 Changed 10 years ago by gnarf

-1, .find( ":input" ).map(...) anyone?

comment:9 Changed 10 years ago by mikesherov

Resolution: wontfix
Status: openclosed
Note: See TracTickets for help on using tickets.