belongsToMany field not saved

Hy

I have a model with a belongsToMany field, when i open the form from the list view (backend) and i fill the belongsToMany field and i save , it works.
But When i open the form in modal from a calendar view, and i fill the belongsToMany field and i save, all the fields are saved except the the belongsToMany field.

Any idea ?

Thanks

Hi @ridha82,

To my knowledge, there isn’t a built-in calendar view in OctoberCMS. If this is part of a custom implementation, it might be challenging to identify the exact issue without more details.

Could you provide additional context or information about your setup? That would help in narrowing down the problem.

Thank you.

Hi,

Yes the calendar is a custom implémentation, i have 10 fields in my modal all are saved, except the belongstomany field.

this how i load the modal, i call the onLoadCrmForm from the view:

 public function onLoadCrmForm()
    {
        try {
            $config = $this->makeConfig('$/rinc/magento/models/crm/fields.yaml');
            $config->alias = 'salesMonitoringForm';
            $config->arrayName = 'Crm';
            if (\Request::has('record_id') && !empty(post('record_id'))) {
                $config->model = Crm::find(post('record_id'));
                $this->vars['recordId'] = post('record_id');
            } else {
                $config->model = new Crm();
                $config->model->appointment_date = post('appointment_date');
                $this->vars['recordId'] = false;
            }
            $widget = $this->makeWidget('Backend\Widgets\Form', $config);
            $widget->bindToController();
            $this->vars['salesMonitoringForm'] = $widget;
            return $this->makePartial('crm_modal_form');
        } catch (Exception $e) {
            return false;
        }
    }

Thanks