How control form inputs if they are empty not run the submit query to db

Hi i have this form

how i can control if i got all required inputs empty it should not trigger or run the submit to db query.

Hi @agaitan026 on the button event handler, in the advanced section you have an option to "Only run when" and there you can set up the condition for the query not to run if the inputs are empty.


If the length of the inputs is not higher than 0 it will return false and the query will not run. You can additionally set up another event handler to show notification if the inputs are empty for the user to be quite aware why the query did not run. Also using validation rules/custom rules are quite helpful in this case.
Hope this helps

1 Like

will try that, but what you mean by: Also using validation rules/custom rules are quite helpful in this case.

You can set the component in the as required, and that will prevent the query to run if the value is empty. You can turn the toggle on or write custom logic that suits your use case. Custom value works in a similar way, where you can write ternary operator to provide a customizable message that will give more insight to the user how is the input supposed to be formatted etc.


1 Like

Yes i did that its already Required field but is not working at all, thats why i ask i i applied what you told me in the submit button. Because required field is not working, not sure if its because im using a api rest instead of writing to db directly

1 Like

Are the inputs inside the form component?

1 Like


yes

Thats weird. Hope the workaround works for the time being.

1 Like

maybe a bug because im using modal, who knows, i will try to create again the form from scratch but thanks for the workaround works good

1 Like

yeah the issue is when you set a query as event handler so maybe its a bug

note: neverming i just created the form again and validation works naturally, thanks

3 Likes