Validations
A
Adam
Thats super-needed. I have problems with it in every custom-project that has even one custom field, and usually i have more
The only way is to put value=null in customfield and make field required, but mostly its just doesnt fit to draft&publish ideology, because if i want to save draft i need to put thata on value to keep it in DB - and because of that i can save with validation errors
On other hand, i can put null in value then i cant publish (field is required), but if i save it as a draft with null i will lost all data that editors put there (and sometimes i have plugins with many fields and options).
On other post i had like proposal to add one more param into forwardRef for input:
({ attribute, name, onChange, value, validationError }: InputProps, ref) => {
And that validationError can be boolean or error message as a string
Alexander Borisenko
A more than a year passed, any progress on that?
Are you saying that Strapi does not have a way for a custom field to be validated? I am talking about actual content creating/editing phase when user clicks Save or Publish buttons, not the phase of adding a new custom field with base & advanced tabs.
I am creating a custom field with tested select options (5 items) each depends on previous select choice. That content field has json storage type. Examle: Audi -> A7 -> 4K -> 3.0 TSFI. I do not have a sophisticated validation rules, I just want to have first 3 Selects required to be filled. Any thoughs how to show user a simple message about that?
Derrick Mehaffy
Merged in a post:
Validations
A
Aurelien Georget
Currently, we don't offer the capability to add validations constraints on a field to avoid to contribute unintended data from the administration or the API.
Nguyen Trinh Anh Toan
I created a collection type which had white spaces in API ID fields. Strapi showed no validation error, but I couldn't save the collection and stuck at that step forever, unless I delete the collection and re-create it.
I think, Strapi should, at least, has a white spaces check for API ID fields.
Thanks,
Kamal Gyanchandani
This will be Great Feature. :-)
F
Florian Krauthan
Yeah it would be really good to be able to write custom field and entity level validations that are displayed in the UI and returned through API.
Some validation examples:
* I want to make sure that start date is before end date
* I want to make sure that a field is filled out if another checkbox is checked
* I want to make sure that a number is a multiple of 10
* ...