Topic: Submitting checkboxes using multipart params

Hi,

I am trying to submit an array of checkboxes using the multipart_params but it does not work.

My up.settings.multipart_params has 'subject': $('#subject').val(),

I have the name and id as subject[] but get no result when calling $_POST['subject'].

Any ideas?

Thanks
Rick

Re: Submitting checkboxes using multipart params

see this:

http://stackoverflow.com/questions/7861 … -in-jquery

Re: Submitting checkboxes using multipart params

Hi Leandro,

I have also sent this as an email to support yesterday with no response. I take it from your answer above that I cannot submit them directly but have to put the values into a textarea and then submit that?

Thanks
Rick

Re: Submitting checkboxes using multipart params

no, what I want to show you is that you can't use $('#subject').val() to get which checkboxes are checked

here's the code you need:

     $('input[type="checkbox"]:checked').each(function() {
       allVals.push($(this).val());
     });
     up.settings.multipart_params = {'subject' : allVals.join()};

Re: Submitting checkboxes using multipart params

Hi Leandro,

Thanks for the response I will give it a go

Cheers
Rick

Re: Submitting checkboxes using multipart params

Hi Leandro,

Still trying to get this to work. I have

var uploader = $("#uploader").pluploadQueue({
        // General settings
        runtimes: 'html5,html4',
        url: 'upload.php',
        max_file_size: '200mb',
        chunk_size: '1mb',
        unique_names: true,
        multiple_queues: true,
        multipart_params: {
            "subject": allVals.join(),
        },
        // Specify what files to browse for
        filters: [
            {
            title: "Image files",
            extensions: "jpg,gif,png,eps,jpeg,pdf,tiff,tif"},
        {
            title: "Zip files",
            extensions: "zip"}
        ],
        init: {
            StateChanged: function(up) {
                if (!uploadInitialized && up.state == plupload.STARTED) {
                    if (!validateForm()) {
                        up.stop();
                    } else {
                        uploadInitialized = true;
                    }
                }
            },
            BeforeUpload: function(up, file) {
            $('input[type="checkbox"]:checked').each(function() {
                       allVals.push($(this).val());
                 });
                up.settings.multipart_params = {
                'title': $('#title').val(),
                'division': $('#division').val(),
                'UserField3': $('#UserField3').val(),
                'UserField4': $('#UserField4').val(),
                'location1': $('#location1').val(),
                'UserField5': $('#UserField5').val(),
                'UserField1': $('#UserField1').val(),
                'UserField2': $('#UserField2').val(),
                'subject': allVals.join(),
                'keywords': $('#keywords').val(),
                'notes': $('#notes').val(),
                'viewable': $('#viewable').val(),
                'assettype': $('#assettype').val() }
            }
        }
    });

Can you please point out where I am going wrong

Thanks
Rick

Re: Submitting checkboxes using multipart params

I couldn't find where you initialize the allVals

var allVals = [];

Re: Submitting checkboxes using multipart params

Sorry about that. Obviously having a stupid moment.

Thanks
Rick