Open miquelangeld opened 1 month ago
Hello @miquelangeld
Can you rephrase? I'm unable to get the problem.
Can you also share the CRUD code so we can know more about the issue?
Hi @karandatwani92 summing up using a select2_json_from_api field, when you select a value and save, the stored value is something like this: {"id":"MURR230044149-1","booking":"MURR230044149-1 Localizador: MUR0002615"}
But if the page reloads after you have selected an option (for example by saving the form without having filled in a required field causing a reload), and then save the form, then the same select2_json_from_api store in DB
[{"id":"MURR230044149-1","booking":"MURR230044149-1 Localizador: MUR0002615"}] adding this square brackets
$this->crud->addField([ 'label' => 'Pax Name', // Table column heading 'type' => 'select2_json_from_api', 'minimum_input_length' => 0, 'name' => 'name', // the column that contains the ID of that connected entity 'attribute' => "name", // foreign key attribute that is shown to user 'include_all_form_fields' => true, 'data_source' => url('/admin/bookings/ajax-bookings-avalon-pax-options'), ]);
I hope I have explained myself better this time :)
ping @karandatwani92
Hi, I'm using select2_json_from_api, here is my code
In the same page I have another select2_json_from_api field but with include_all_form_fields = true