Datatables Editor posts and array for a checkbox

Datatables Editor posts and array for a checkbox

NettSiteNettSite Posts: 36Questions: 11Answers: 2

Hi,

I have an Editor form with a checkbox as follows:

{
'name':'send_mail',
'label':'Send Mail',
'data': 'send_mail',                                                                                                                                                                  'options':{"Yes":true},
 'type':'checkbox',
}

When I attempt to add a new record, Editor submits the checkbox as an array,

data[0][send_mail][]: true

I am not using the Datatables PHP libraries, I am in fact using Laravel with the Yajra implementation.

I could put something in place to change the array to a simple variable on the server side, but I would prefer not to.

Is there a way I can persuade Editor to send a simple variable?

data[0][send_mail]: true

Thanks,

Will.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,192Questions: 1Answers: 10,412 Site admin
    Answer ✓

    Hi Will,

    The checkbox field type has a separator option which will basically join the array with the given character - e.g. to have a comma delimited list of values:

    {
    'name':'send_mail',
    'label':'Send Mail',
    'data': 'send_mail',                                                                                                                                                                  'options':{"Yes":true},
     'type':'checkbox',
     'separator': ','
    }
    

    Allan

This discussion has been closed.