Custom Fields keep Format requirements when switching Form Element
Debug mode
- [X] I have enabled debug mode
- [X] I have read checked the Common Issues page
Describe the bug
The Format requirement to a specified format, in my case BOOLEAN, is kept when switching Format Element. Because of this the selection I made during asset creation that contained the custom field did not save and showed incorrect value derived from the old requirement.
The reproduction steps may be applicable on other Formats and other Form Elements.
Reproduction steps
- Start creating a Custom Field and for Form Element choose Text Box
- Set Format to BOOLEAN
- Change Form Element to Radio Buttons
- Enter desired Field Values and other info and hit Save
- The Custom Field will now be of Element type 'radio' but Format type 'BOOLEAN'.
- Use this field when creating an asset and choose any of the radio buttons. Even if the field is set to be required for its Fieldset the asset will save but whatever you chose will not be saved and will show a red (X) as in 'False' for the type BOOLEAN in the asset list.
- Edit the asset and the selection will be cleared.
Expected behavior
One should be allowed to choose any of the radio buttons and they should be saved with that chosen value. It should not require to adhere to whatever Format was first highlighted when using another type of Form Element.
When switching from a Form Element with a Format option to a Form Element without a Format option, the Format requirement should be wiped or plainly set as 'ANY' per default.
Screenshots

Snipe-IT Version
v6.0.1 - build 7750
Operating System
Ubuntu 22.04 TLS
Web Server
Apache
PHP Version
7.4
Operating System
Windows
Browser
Google Chrome
Version
100.0.4896.127
Device
No response
Operating System
No response
Browser
No response
Version
No response
Error messages
This is reproduceable in the demo. Can't see any errors being thrown with debug mode on.
$ php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
ldap
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zip
zlib
$ cat <installation directory>/storage/logs/laravel.log
[...]
[2022-05-24 16:40:26] <REDACTED>
I.e. no log entry has been generated for this problem as I encountered it today.
Additional context
This is on a fresh install. I used the git fetch method to install (the one which says it's easy to upgrade). Installation server side is complete and I've been adding custom fields, sets, vendors, manufacturers, assets, etc.. I have not touched the database in any way, shape or form. I only created it and assigned the Snipe-IT user to it as instructed.
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.