Registration form errors on email input error but still registers user

By: Jay Mac | Asked: 11/24/2023
ForumsCategory: General questionsRegistration form errors on email input error but still registers user
Jay Mac asked 5 months ago
If a new user enters their email and then enters their email again to confirm but mistypes it the form error's as it should but it also creates the user. When the user corrects their input error and submits again the form then errors with the message the email address is not unique.  Anyone have the same problem and or fix? thanks, J
1 Answers
Victor Font answered 5 months ago
When you say, "If a new user enters their email and then enters their email again to confirm", I'm assuming you have an email field on your form where the Require Confirmation dropdown has either Inline or Below Field selected. A new user creates an entry, makes a mistake confirming the email address, corrects the mistake and it appears that the WordPress user record was created before the entry was created. This suggests two questions that would be helpful to know. I'll continue in the comments.
Victor Font replied 5 months ago

From your description, this sounds like a timing issue in the execution chain. You didn't say if your are using the Formidable User Registration add-on or if you're creating the new user record through custom code and WordPress hooks. Detailed questions really help us understand the problem better to provide an answer based on assumptions. I have to assume you're using the Formidable add-on.

The error message you are getting is provided by WordPress. Formidable is built on top of WordPress and hands off certain functionality that is built into WordPress to WordPress. WordPress handles the user registration process and communicates the results to Formidable as the front end tool.

The error message is the indicator to me that this is the timing issue. I believe you are validating the form on the server after someone presses the submit button. You never explained in your post when the submit button is pressed in your process. Understanding the process is an important criterion for approaching diagnostics.

As a performance best practice, simple validations like confirming email addresses are done in the browser with Javascript. To do this, make sure the "Validate this form with javascript" checkbox is checked on the form's general settings page. This ensures the email validation will be done before the submit button is pressed. You could even use a tool like QuickEmailValidation to further validate the existence of the email address.

When creating a new user record through Formidable's add-on, the WordPress user ID is a critical data element for the cohesion required between WordPress and the entry. This is why I believe the add-on fired early before the email validation occurred. This can only happen if the validation happened after the submit button was pressed and not in the browser as a recommended best practice.

Did you uncover a bug in Formidable? I don't know. No one has ever reported this problem in the public communities in which I participate and I've never seen this myself. If following what I suggest doesn't work, then you should open a ticket with Strategy 11 because it will require hands-on troubleshooting.

Jay Mac replied 5 months ago

Hi Victor -

The user inputs their email
The user inputs their email in the confirmation field but types it incorrectly so that it does not match the original
The form indicates an error that the emails do not match
The user ignores the error and proceeds to complete the form
The user submits the form with the submit button and the form errors saying the emails do not match
Formidable creates the user and submits the form entry anyway despite the error
The user corrects the error in the email confirmation field so that they match and clicks the submit button again
Formidable errors with the message “the email is not unique”

There is no validation other than what Formidable supplies in their registration add on plugin. There is no custom code involved. A simple form that registers a new user once the user clicks the submit button at the end of the form.

Thanks, J

Victor Font replied 5 months ago

I suggest you open a ticket with Strategy 11. You need someone to look at your server to find out why the JavaScript validation isn't preventing the submit.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community