Registration form error

Hi everyone I’m new to wappler and I’m developing my first website.
I followed the tutorial for registering a new user (https://www.youtube.com/watch?v=ywGdwbNi2wk&list=PLUjqTJN3byC9W9UFjsV9f9vefe_ZSFQfb&index=10) and I have some problems to solve.

The first problem concerns the validate data step in the API registration.
I set up the check to check if a user with the email already exists in the database but I can’t intercept the error to show a notification in the form’s dynamic events.

The second question is this, I have to write the letter P or C in the roles table based on the value of a checkbox.
Can I pass this variable from the form to the API or do I do it through a particular step directly from the API?

Last question, the value of the checkbox (Switch control) present in the form is always inserted NULL in the SQL database (fields of type BIT)

I’m attaching some screenshots for clarity

Hi Enrico, welcome aboard. In answer to the questions:

  1. If the email already exists in the database, the message will appear under the form input.
  2. Checkboxes are strange animals. They will post a value only when checked.
  3. See 2.

I hope that helps.

Thanks for the replies Ben, regarding point 1, do I have to indicate the name of the form field in the Linked Field space to make the user see the error in the form?

Yes

Perfect now it works correctly!

In my registration procedure, if a user enters a fake email and the last step fails, the workflow goes into error but in reality he has already entered the user’s data in the database.
Is there a better logic to construct this flow? Or can I enter sending the email as the first step and handle a custom error?

Immagine 2023-05-11 103013

Hi Enrico,

Welcome to the community!

By fake email, are you referring to an invalid email address? To stop a new user from entering an invalid email, you can add Validation Rule E-mail on the email form input. This validation rule on the form will check whether a valid email address has been entered and if not, the form will not be submitted until a valid email address has been provided by the user.

If the last step Send Email is failing due to an invalid email address, then that won’t be the case once a valid email address has been provided.

Another logic could be:

  • when a user has been successfully registered, save the basic required information such as name, email address, password etc.
  • send an email to the registered user with a link to activate the account
  • when user has activated the account, then other steps such as creating folders and copying file can be performed
  • if an account is not activated for a certain number of days, you can either send a reminder and/or delete the account, depending on your business rules.
1 Like

Thanks for the suggestions, I’ll try to figure out which is the best way!