Results 1 to 6 of 6

Thread: [HELP] my checkboxgroup getting value "[object Object]"

  1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    9

    Default [HELP] my checkboxgroup getting value "[object Object]"

    My Source Code:
    Code:
    var pilihhari = new Ext.form.CheckboxGroup({
            id:'pilihhari',
            xtype: 'checkboxgroup',
            fieldLabel: 'Pilih Hari',
            itemCls: 'x-check-group-alt',
            anchor: '60%',
            columns: 7,
            items: [
                {boxLabel: 'Senin', name: 'Senin', value: 'Senin', checked: true},
                {boxLabel: 'Selasa', name: 'Selasa', value: 'Selasa'},
                {boxLabel: 'Rabu', name: 'Rabu', value: 'Rabu'},
                {boxLabel: 'Kamis', name: 'Kamis', value: 'Kamis'},
                {boxLabel: 'Jumat', name: 'Jumat', value: 'Jumat'},
                {boxLabel: 'Sabtu', name: 'Sabtu', value: 'Sabtu'},
                {boxLabel: 'Minggu', name: 'Minggu', value: 'Minggu'}
            ]
        });
    My Getting Code:
    Code:
    Ext.getCmp('pilihhari').getValue();
    My question is when it inserted on my database, why i getting value "[object Object]". There is wrong with my getting value??? plzzz help me...

  2. #2
    Sencha User
    Join Date
    Dec 2010
    Posts
    139

    Default

    Are you sure you add your checkboxgroup to a component or you render it on the page?

    It should return an array of objects, each object being a checked checkbox.

  3. #3
    Sencha User
    Join Date
    Nov 2010
    Posts
    9

    Default

    Quote Originally Posted by drian View Post
    Are you sure you add your checkboxgroup to a component or you render it on the page?

    It should return an array of objects, each object being a checked checkbox.
    I want to store checked object in my database, ex: i checked senin, selasa, and rabu. then in my database inserted "Senin, Selasa, Rabu" <<< like this... how i can resolve this!???

  4. #4
    Sencha User
    Join Date
    Nov 2010
    Posts
    9

    Default

    Quote Originally Posted by drian View Post
    Are you sure you add your checkboxgroup to a component or you render it on the page?

    It should return an array of objects, each object being a checked checkbox.
    plzzzzzzz.... help me to make looping, plzzz gi'me ex to create that...

  5. #5
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    1. You want 'inputValue' instead of 'value'.

    2. checkboxGroup.getValue() returns an array of the selected checkboxes. You have to collect their inputValues yourself, e.g.
    Code:
    var value = [];
    Ext.each(checkboxGroup.getValue(), function(checkbox){
      value.push(checkbox.inputValue);
    });
    value = value.join(', ');

  6. #6
    Sencha User
    Join Date
    May 2011
    Posts
    7

    Default

    Thanks.

Similar Threads

  1. Replies: 1
    Last Post: 18 Jun 2010, 12:54 AM
  2. Replies: 6
    Last Post: 3 Mar 2008, 1:29 AM
  3. Replies: 1
    Last Post: 1 Oct 2007, 6:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •