Fixxed the form serialize function as seen on the mailing list.
This commit is contained in:
parent
956529c7be
commit
f1c8b3ffc0
24
ajax/ajax.js
24
ajax/ajax.js
|
@ -141,11 +141,27 @@ $.fn.load = function(a,o,f) {
|
||||||
/**
|
/**
|
||||||
* function: $.fn.formValues
|
* function: $.fn.formValues
|
||||||
* usage: $('#frmLogin').formValues()
|
* usage: $('#frmLogin').formValues()
|
||||||
* docs: Gets the form values and creates a key=>value array of the found values (only for ENABLED elements!)
|
* docs: Gets form values and creates a key=>value array of the found values (for ENABLED elements!)
|
||||||
*/
|
*/
|
||||||
$.fn.formValues = function() {
|
$.fn.formValues = function() {
|
||||||
var a = [];
|
var a = [];
|
||||||
this.find("input[@type='submit'],input[@type='hidden'],textarea,input[@checked],input[@type='password'],input[@type='text'],option[@selected]").filter(":enabled").each(function() {
|
this.find("input,textarea,option")
|
||||||
|
.filter(":enabled")
|
||||||
|
.each(function() {
|
||||||
|
//
|
||||||
|
// Skip selects with options which aren't selected
|
||||||
|
if (((this.parentNode.type == 'select-one') || (this.parentNode.type == 'select-multiple')) &&
|
||||||
|
(!this.selected))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Skip radio and checkbox elements which aren't checked
|
||||||
|
if (((this.type == 'radio') || (this.type == 'checkbox')) &&
|
||||||
|
(!this.checked))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//
|
||||||
|
// All other elements are valid ;)
|
||||||
var o = {};
|
var o = {};
|
||||||
o.name = this.name || this.id || this.parentNode.name || this.parentNode.id;
|
o.name = this.name || this.id || this.parentNode.name || this.parentNode.id;
|
||||||
o.value = this.value;
|
o.value = this.value;
|
||||||
|
@ -170,7 +186,9 @@ $.update = function(objElement, strURL, arrValues, fncCallback) {
|
||||||
//
|
//
|
||||||
// Evaluate the scripts
|
// Evaluate the scripts
|
||||||
objElement.html(strHTML).find("script").each(function(){
|
objElement.html(strHTML).find("script").each(function(){
|
||||||
try { $.eval( this.text || this.textContent || this.innerHTML ); } catch(e){}
|
try {
|
||||||
|
$.eval( this.text || this.textContent || this.innerHTML );
|
||||||
|
} catch(e) { }
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue