Posted: June 14, 2018 at 8:03 am
|
Hi, I’ve coded an ajax call for checking if the email is already registered for the specific event (and throws a simple javascript alert if already found otherwise continue to payment step). This works fine for data that is pre-filled for logged in users. But if the form is blank on page load and the users fill in their details and submit it throws an error that the fields are required. Why is it not submitting the data that is filled by the user. My ajax call javascript:
My ajax PHP:
|
Hi there, I tested your code locally and didn’t run into a problem: http://take.ms/YzEeE I did change this:
To be:
That way it doesn’t matter on the length of your event ID’s like it does with your code but other than that it seems to be working fine. Is there an event I can view the problem on your site? |
|
|
That’s good news I suppose ๐ I’ve updated the code according to your suggestion, you can try http://pia.dieselbrook.co.za/events/gerald-steyn-leadership-and-communication/, or any event on that site. |
If you remove your custom code from the page, does the same happen? |
|
|
no, it goes through to the payment section. |
I tried your site and after I submitted the form it said the First Name was a required value (even though that was filled out). My guess is there’s another script on the page that’s conflicting with the form validation. As an aside, I added your custom code into a plugin on a dev site and found it works as expected. |
|
|
Hi, just to give an update on this. In case it helps someone else who have the same issue. Feel free to use the code in order to make this work for your site/plugin (accreditation would be nice, but isn’t necessary). I still have no idea what happened and where the original problem was ๐ When users were logged in, the registration worked fine. However non logged out users still got the error that data wasn’t submitted correctly. I disabled all plugins except the event plugin and its addons, and switched to the default (twentysixteen) theme, the problem still persisted… Then, I updated the event espresso plugin (was a version or two behind), and the problem is resolved, so you can close the ticket. |
Thanks for the update and sharing your code. I’m not sure how updating EE helped with this but I’m glad it’s working either way. |
|
One potential gotcha to be aware of is the script loading order. For example in the above example code you have this:
Since the script depends on the jQuery library you’ll need to make sure it’s loaded after the jQuery library is loaded onto the page, so you change it to:
which tells WordPress to load the custom script after the jQuery library is loaded. Even better, you can load the script after the closing body tag:
|
|
The support post ‘Unique emails upon registration’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.