views:

295

answers:

1

Hi everyone,

I use jeditable in my project where I dynamically update lots of different types of content: text, textarea and select.

I would need a new type to meet one of my needs : a multi-select type that could be called "selectmulti".

When editing the field typed "selectmulti", a select list appears and would allow users to select multiple choices. Saving would return an array and update.php will store this array in my DB.

Ex:

    <div class='border'><span class='title'>Language: </span><span class='editableLang' id='contact_language'>".$row['contact_language']."</span></div>

And the Javascript function:

    $('.editableLang').editable('update.php', { 
        data        : '<?php print json_encode($tab_lang); ?>',
        id          : 'cellid',
        name        : 'cellvalue',
        event       : 'dblclick',
        tooltip     : 'Double click to edit...',
        submitdata  : {id: "<?php echo $id_contact; ?>"},
        type        : 'selectmulti',
        style       : 'display: inline',
        submit      : 'Save',
        cancel      : 'Cancel'
     });

I just can't figure out how to get the different values in an array (in my case 'cellvalue' would be the array) and save it in the DB.

Any help or advice would be greatly appreciated !

Cheers

A: 

If anyone interested, my solution is on jsbin: http://jsbin.com/ixuye4/edit

Jonas