A submit button's value is only submitted to a server if it is clicked -
.serialize() has no reason to serialize it (explicitly) because it doesn't
watch for clicks occurring.

I recommend the jQuery Form plugin for that:
http://malsup.com/jquery/form/#api

--John


On Fri, Jul 24, 2009 at 1:26 PM, Mackram <mack...@gmail.com> wrote:

>
> Hey everyone,
>
> So i was trying to use the .serialize() function found in the library
> and I discovered that the function does not take into consideration
> the input type submit. This is weird since the documentation does not
> point this out. Furthermore, I think that this input type should be
> part of the output since it probably is usefull to determining the
> action on the server side.
>
> Can someone explain the reason behind this decision? or is this a bug
> that needs to be fixed.
>
>
> ///// serialize function from jquery-1.3.2
> serialize: function() {
>                return jQuery.param(this.serializeArray());
>        },
>        serializeArray: function() {
>                return this.map(function(){
>                        return this.elements ?
> jQuery.makeArray(this.elements) : this;
>                })
>                .filter(function(){
>                        return this.name && !this.disabled &&
>                                (this.checked ||
> /select|textarea/i.test(this.nodeName) ||
>
>  /text|hidden|password|search/i.test(this.type)); //<<- here would
> be the missing type submit
>                })
>                .map(function(i, elem){
>                        var val = jQuery(this).val();
>                        return val == null ? null :
>                                jQuery.isArray(val) ?
>                                        jQuery.map( val, function(val, i){
>                                                return {name: elem.name,
> value: val};
>                                        }) :
>                                        {name: elem.name, value: val};
>                }).get();
>        }
> });
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to