You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the same page I have another select2_json_from_api field but with include_all_form_fields = true
$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'),
]);
``
When I click on the second field ('name') this is what I get in my controller from the first field:
{"id":"MURR230044149-1","booking":"MURR230044149-1 Localizador: MUR0002615"}
But i f for some reason I reload (for example if I forgot to fill any mandatory field and then click again in name i receive this, note that now I get extra square brakets on the first field booking.
[{"id":"MURR230044149-1","booking":"MURR230044149-1 Localizador: MUR0002615"}]
### PHP VERSION:
8.2.17
### PHP EXTENSIONS:
Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, random, Reflection, SPL, session, standard, sodium, mysqlnd, PDO, xml, bcmath, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, iconv, imap, intl, ldap, exif, mysqli, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, readline, shmop, SimpleXML, soap, sockets, sqlite3, sqlsrv, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, pdo_sqlsrv, Zend OPcache
### LARAVEL VERSION:
10.48.14.0
### BACKPACK PACKAGE VERSIONS:
backpack/backupmanager: v5.0.3
backpack/basset: 1.3.4
backpack/calendar-operation: 1.0.5
backpack/crud: 6.7.17
backpack/devtools: 3.1.5
backpack/editable-columns: 3.0.9
backpack/generators: v4.0.5
backpack/logmanager: v5.0.2
backpack/permissionmanager: 7.2.1
backpack/pro: 2.2.4
backpack/settings: 3.1.1
backpack/theme-coreuiv2: 1.2.4
backpack/theme-coreuiv4: 1.1.1
backpack/theme-tabler: 1.2.10
The text was updated successfully, but these errors were encountered:
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 :)
miquelangeld
changed the title
select2_json_from_api behaviour when page is reloaded
select2_json_from_api behaviour when form is reloaded
Jul 16, 2024
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
The text was updated successfully, but these errors were encountered: