checkbox is always "on"

Thiago picture Thiago · Jul 6, 2011 · Viewed 24.5k times · Source

Hy!

When Uploadify send the file to the action, I need to know if the checbox is checked or not, so I did:

    $('#uploaded').uploadify({
        'uploader': '/uploadify.swf',
        'cancelImg': '/cancel.png',
        'script': '/Interaction/Upload',
        'multi': true,
        'auto': false,
        'method': 'post',
        'scriptData': {'Checkbox': $('#checkbox').val()},
    });

But I aways get an "on" value. No matter if is checked or not.

can anyone help? Tks.


UPDATE:

I realized that uploadify is getting the checkbox when the page is loaded.This means that if I change the checkbox (or any other type of input) the uploadify will get the initial value, in this case, "checkbox = false".

How can I send a form with uploadify?

Tks.

Answer

MikeM picture MikeM · Jul 6, 2011

try $('#checkbox').is(':checked')