Hai everybody,

i have following error.

user click dialogbox ok button.the above error was comming.
what is the problrm in my code

var c,pCrop,crop_api,rotate = false;
    var temp,tempZIndex;
    var imgCount = 0,imgList = new Array();
    var fileSizeOption = "";

    $(document).ready(function()
    {

            // $('#btnUploadPlanPicture').bind("mouseup", function()
            $('#btnUploadPlanPicture').mouseup(function()
            {
                var id =$('#btnUploadPlanPicture').attr('id');


                 if(id=='btnUploadPlanPicture')
                    {
                    $(this).find('input[type = "file"]').trigger('click');  
                 //$('input[name="file"]').focus().trigger('click'); 
                 $('#btnUploadPlanPicture').css('display','none');
                    }



             });

        var uploader = new qq.FileUploader(
            {
            //uploader.startUpload();

            element: document.getElementById('btnUploadPlanPicture'),
            action: upload_url,
            params: 
            {
                album: album,
                type: 'plan',
                desc: 'plan',
            },

            allowedExtensions: ['jpg','png','gif'],

            onSubmit: function(id,filename)
            {

                imgCount = 0;

                imgList = new Array();
                fnOpenDialog();

            },

            onComplete: function(id, fileName,responseJSON)
            {       


                imgList[imgCount++] = 
                {
                    id              :   responseJSON.id,
                    imagetakendate  :   responseJSON.imagetakendate
                };
                createPlanspaceImage(responseJSON);
                return true;
            },

            onAllComplete: function(status)
            {       


                 if(fileSizeOption =="Random")
                                     {

                                     ArrRandomly();
                                     imgGroup();


                                     }

                          if(fileSizeOption =="TimeTaken")
                                 {

                                sortByTimeTaken();
                                imgGroup();
                                 }
                        if(fileSizeOption =="notarrange")
                                {
                                notArrange();
                                //alert("not arrange");
                                } 

            }

            });

            uploader.onSubmit;



        //});
        //});





    });

    function createPlanspaceImage(data)
    {
        //alert(uploadFilePath);
        //var responseJSON = $.parseJSON(data);
        var responseJSON = data;
        var uploadFilePath = responseJSON.filePath;

        var cWidth = $('#container_upload').css('width');
        var cHeight = $('#container_upload').height();
        //alert(cWidth);
        imgTagStr = "";
        imgTagStr += "<div id='image_container' class='planspace-image' style='position:relative; left=12px;' >";
        imgTagStr +=    "<div class='image_controls' id='control-"+responseJSON.fileName+"' style='display:none; z-index:1;'>";
        imgTagStr +=        "<img src='../images/rotate.png' class='rotate' width='20px' >";
        imgTagStr +=        "<img src='../images/remove.png' class='remove' width='20px' >";
        imgTagStr +=        "<img src='../images/crop.png' class='crop' width='20px' >";
        //imgTagStr +=      "<img src='../images/resize.png' class='resize' width='20px'>";
        imgTagStr +=    "</div>";
        imgTagStr +=    "<img class='upload_pic' name='"+responseJSON.fileName+"' src='"+uploadFilePath+"' id="+responseJSON.id+" rotate=0 width=200 height=200 />" ;
        imgTagStr += "</div>";                                           

        $('#container_upload').append(imgTagStr);
        $('#container_upload').css('width','+='+400);
        $('#planspace').css('width','+='+400);


        $(document).ready(function()
        {

            $('.upload_pic').parent().mouseover(function(e)
            {

                $(this).css('border','orange 1px solid');
                //alert($(this).attr('id'));
                var uploadPic = $(this).find('.upload_pic');
                var controlDiv = document.getElementById($(this).find('.image_controls').attr('id'));

                tempZIndex = $(this).css('z-index');
                $(this).css('z-index','2');
                controlDiv.style.display = 'block';
                updateControlImageCoords($(this));
                attachEventsImage($(this));

            })
            .mouseout(function(e)
            {
                if(mode != 'rotate')
                {
                    $(this).css('border','none');
                    var uploadPic = $(this).find('.upload_pic');
                    var controlDiv = document.getElementById($(this).find('.image_controls').attr('id'));
                    detachEvents($(this));
                    controlDiv.style.display = 'none';
                }

            });


            /*$('.upload_pic').click(function(e)
            {
                var uploadPic = $(this);
                var controlDiv = document.getElementById($(this).parent().find('.image_controls').attr('id'));

                $('html').click(function(e)
                {
                    if( e.target.id == uploadPic.attr('id') )  
                    {
                        //$('#test-text').html('in clicked'+e.target.id);
                        //tempZIndex = $(this).parent().css('z-index');
                        //$(this).parent().css('z-index','2');
                        //controlDiv.style.display = 'block';
                        //updateControlImageCoords($(this).parent());
                        //attachEvents($(this).parent());

                        tempZIndex = uploadPic.parent().css('z-index');
                        uploadPic.parent().css('z-index','2');
                        controlDiv.style.display = 'block';
                        updateControlImageCoords(uploadPic.parent());
                        attachEventsImage(uploadPic.parent());


                    }

                    else 
                    {
                        //$('#test-text').html('out clicked'+e.target.id);
                        detachEvents(uploadPic.parent());
                        controlDiv.style.display = 'none';
                    }

                });

            });*/


        });

    }

    function sortByTimeTaken()
    {

        imgList.sort(sortByDate);

        function sortByDate( obj1, obj2 ) 
        {

            return new Date(obj2.date) > new Date(obj1.date) ? -1 : 1;
        }

    }

    function notArrange()
    {

    imgList.css('height','250');
    imgList.css('float' ,'left');
    imgList.css('position','relative');
    imgList.css('padding-right','25');


    }

    function imgGroup()
    {
        var count = 0;

        while(count<imgList.length)
        {
            var groupSize = Math.floor(Math.random() * (4 - 2 + 1)) + 2;
          //var groupSize = 4;


            var ele = new Array();

            for(var i=0; i<groupSize && count<imgList.length ; i++,count++)
            {
                ele[i] = imgList[count];

            }

            if(groupSize==2)
            {


                //image A
                var imgA = $('#'+ele[0]);
                imgA.css('height','350');
                //imgA.css('width','350');
                imgA.attr('rotate','0');
                imgA.parent().css('height','350');
                //imgA.parent().css('width','350');
                imgA.parent().css('transform','rotate(0deg)');

                //image B
                var imgB = $('#'+ele[1]);
                imgB.css('height','380');
                imgB.parent().css('padding-right','100');
                imgB.attr('rotate','5');
                imgB.parent().css('height','350');
                imgB.parent().css('width','450');
                imgB.parent().css('transform','rotate(5deg)');

                imgB.parent().css('left',imgA.parent().css('left'));
                imgA.parent().css('left',imgB.parent().css('left')-17);
                imgA.parent().css('z-index','1');
                //imgA.parent().css('position','relative');

            }
            else if(groupSize==3)
            {

                var imgA = $('#'+ele[0]);
                imgA.css('height','280');
                //imgA..css('position','relative');
                //imgA.css('width','280');
                imgA.attr('rotate','-5');
                imgA.parent().css('height','280');
                //imgA.parent().css('width','280');
                imgA.parent().css('transform','rotate(-5deg)');

                //image B
                var imgB = $('#'+ele[1]);
                imgB.css('height','320');
                //imgB.css('width','320');
                //imgB.css('position','relative');
                imgB.attr('rotate','15');
                imgB.parent().css('height','320');
                //imgB.parent().css('width','320');
                imgB.parent().css('transform','rotate(15deg)');

                //image C
                var imgC = $('#'+ele[2]);
                //imgC.css('position','relative');
                imgC.css('height','215');
                //imgC.css('width','215');
                imgC.attr('rotate','10');
                imgC.parent().css('height','215');
                imgC.parent().css('width','315');
                imgC.parent().css('transform','rotate(10deg)');
                imgC.parent().css('position','relative');
                //imgB.parent().css('left',imgA.parent().css('left'));
                //imgA.parent().css('left',imgB.parent().css('left')-17);
                //imgA.parent().css('z-index','1');
                imgC.parent().css('padding-right','100');


            }

            else if(groupSize==4)
            {

                //image A
                var imgA = $('#'+ele[0]);
                imgA.css('height','220');
                imgA.css('width','220');
                imgA.attr('rotate','5');
                imgA.parent().css('height','220');

                imgA.parent().css('transform','rotate(5deg)');

                //image B
                var imgB = $('#'+ele[1]);
                imgB.css('height','190');
                imgB.css('width','190');
                //imgB.css('position','relative');
                imgB.attr('rotate','-8');
                imgB.parent().css('height','190');
                //imgB.parent().css('width','190');
                imgB.parent().css('transform','rotate(-8deg)');

                //image C
                var imgC = $('#'+ele[2]);
                imgC.css('height','230');
                //imgC.css('width','230');
                //imgC.css('position','relative');
                imgC.attr('rotate','-5');
                imgC.parent().css('height','230');
                //imgC.parent().css('width','230');
                imgC.parent().css('transform','rotate(-5deg)');

                //image D
                var imgD = $('#'+ele[2]);
                imgD.css('height','225');
                //imgD.css('width','225');
                imgD.attr('rotate','0');
                imgD.parent().css('height','225');
                //imgD.parent().css('width','325');
                imgD.parent().css('transform','rotate(0deg)');

                imgD.parent().css('padding-right','100');
                //imgD.css('position','relative');

            }


        //groupSize.css('float','left');

        }




    }

    function ArrRandomly()
    {

        for (var i = imgList.length - 1; i > 0; i--) 
        {
            var j = Math.floor(Math.random() * (i - 0 + 1)+0);
            var temp = imgList[i];
            imgList[i] = imgList[j];
            imgList[j] = temp;
        }
    //alert(JSON.stringify(imgList));
        return imgList;

    }


    function fnOpenDialog() {

        //alert(responseJSON);

       $Dialog_div = $('#autoarrange').dialog({
        autoOpen: true,
        draggable: true,
        resizable: true,
        title: 'Dialog',
        modal: true,
        stack: true,
        height: '400',
        width: '200px',


 buttons: {

            'OK':

            function() {
                      fileSizeOption=$("#arrangeoption option:selected").val();
                        //alert(fileSizeOption);
                    if(fileSizeOption =="Random")
                                     {
                                    //alert("random");

                                     ArrRandomly();
                                     imgGroup();


                                     }

                         if(fileSizeOption =="TimeTaken")
                                 {

                                sortByTimeTaken();
                                imgGroup();
                                 }
                        if(fileSizeOption =="notarrange")
                                {
                                //notArrange();
                                //alert("not arrange");
                                }




                        //alert(fileSizeOption);
                            $Dialog_div.dialog('close');







           }

     // $Dialog_div.dialog('close');

          } 

      });

 }

anybody plz help me.
urgent.

What line causes this error?

This usually happens when you get an element by ID and then use the hadle forgetting to use innerText or innerHTML. e.g.

var div = document.getElementById("myDiv");

var text = "My div says " + div;

this would produce the string "My Div says [object Object]"

as pritaeas said, though. we would need to know which line causes the error.

Member Avatar for stbuchok

It looks like it could happen on the following lines:

252
261
278
288
298
319
328
338
348

The reason I think this is that if you look at this:

var imgC = $('#'+ele[2]);

ele[2] could be and object, if it is, jQuery will look at it as thought it were this:

$('#[object Object]') which jQuery shouldn't know how to parse which mean you get an error.

You can confirm this by using Firebug or Web Developer Toolbar.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.