(autocomplete) extraParams get hidden inputs

(autocomplete) extraParams get hidden inputs

How do I put all the hidden inputs from the surrounding form into extraParams?

I'm a jquery noob so maybe I'm going about this all wrong.

This doesn't work.
  1. function getHiddens(obj) { console.log("processing params"); var array = new Array(); $(obj).parents('form:first').children('[type=hidden]').each(function () { console.log(this['name']); array[this['name']] = this['value']; }); return array; }
  2. function getHiddens(obj) { console.log("processing params"); var array = new Array(); $(obj).parents('form:first').children('[type=hidden]').each(function () { console.log(this['name']); array[this['name']] = this['value']; }); return array; }
  3. $(".auto").autocomplete("search.php?returnType=json",{
  4. dataType: "json",
  5. minChars: 3,
  6. autoFill: true,
  7. extraParams: getHiddens(this),
  8. parse: function(data) {
  9. var array = new Array();
  10.                 for(var i=0;i<data.length;i++)
  11.                 {
  12.                         array[array.length] = { data: data[i], value: data[i]['title'], result: data[i]['title'] };
  13.                 }
  14.                 return array;
  15. },
  16. formatItem: function(row) {
  17. return row['title'];
  18. }
  19. });


  1. $(".auto").autocomplete("search.php?returnType=json",{
  2. dataType: "json",
  3. minChars: 3,
  4. autoFill: true,
  5. extraParams: getHiddens(this),
  6. parse: function(data) {
  7. var array = new Array();
  8.                 for(var i=0;i<data.length;i++)
  9.                 {
  10.                         array[array.length] = { data: data[i], value: data[i]['title'], result: data[i]['title'] };
  11.                 }
  12.                 return array;
  13. },
  14. formatItem: function(row) {
  15. return row['title'];
  16. }
  17. });