#Any suggestions on how to handle form being empty?

6 messages · Page 1 of 1 (latest)

half scroll
#

Hi I have a form with the following fields:
-URNumber (Number)
-LabNumber (Number)
-GPFacility (Alpha Numeric String)

This form is used to to query a MySQL database. Each field increases specificity, and as such only one field is necessary. A user could hypothetically submit 1-3 fields. How could you implement form feedback incase all fields are empty?

I could check if its empty onSubmit and set an error below the submit button, however clearing the error text would be messy since Ill have to pass a update function to each field of the form and then reset the error onUpdate. Any suggestions on how to do this in a less messy way?

snow arrow
#

interested as well

#

i transform empty fields to a null value, but i do this because i have no idea what will happen if i dont

half scroll
#

The reason Im trying to avoid my original approach is because using my own error system for verifying if the form is empty alongside Mantine's inbuilt error system for other cases sounds really messy 😅

half scroll
#

@winter magnet is there any inbuilt functionality in the form module to handle a scenario where atleast one field must me entered? i looked around and the closest thing is isEmpty