Skip to main content

Bug Tracker

Side navigation

#4523 closed bug (invalid)

Opened April 12, 2009 12:41AM UTC

Closed April 13, 2009 12:15AM UTC

:input selector doesn't work for checkboxes

Reported by: allspiritseve Owned by:
Priority: minor Milestone: 1.3.2
Component: unfiled Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

I'm submitting a form through ajax, using :input to grab all the form values. However, it is not distinguishing whether checkboxes have been checked or not... it just grabs the value anyways.

Attachments (0)
Change History (2)

Changed April 12, 2009 12:46AM UTC by allspiritseve comment:1

Here's what I'm using, if that helps at all:

$(document).ready(function() {

$('#addtocart').click (function() {

$.ajax ({

type: "POST",

url: 'includes/ajaxcart.php',

dataType: 'json',

data: $(':input'),

success: function (result) {

$('#bagcount').text (result.count);

alert (result.message);

}

});

return false;

});

});

Changed April 13, 2009 12:15AM UTC by dmethvin comment:2

resolution: → invalid
status: newclosed

The value property of a checkbox (which you are getting indirectly) is the same whether its checked attribute/property is set or not.

If you want the values of all the form elements as they would have been if you submitted the form, look at the formSerialize method in the Forms plugin.