Support

Home Forums Event Espresso Premium Registration Date Validation

Registration Date Validation

Posted: July 25, 2016 at 10:25 pm

Viewing 5 reply threads


dcorso

July 25, 2016 at 10:25 pm

Hi, I need to be able to restrict registration to some events based on age, however there are a few age ranges. In fact I would like to allow the event manager to select the min age and max age of their attendees. I have created those custom fields for the events. What I need to be able to do is get access to those custom fields and also the event date on the registration page to run some jquery to validate the birth date they enter on the registration form.

How can I do this?

Cheers,
Rachel


Tony

  • Support Staff

July 26, 2016 at 4:17 am

Hi Rachel,


@Josh
previously posted and example of how you can add some custom jQuery validation to the EE registration form here:

https://gist.github.com/joshfeck/86a93df2cddfa7efba7427e66ab0b22b


dcorso

July 26, 2016 at 5:52 am

Hi Tony,

I don’t think I have a problem triggering any jquery, it’s more about how to access the event ID so I can make an ajax call or something to return the event start date and custom fields.

It would be great if the event id was in a hidden field or something for each event question list. Is there some way I can output it on that page so I can reference it?

Cheers,
Rachel


Tony

  • Support Staff

July 26, 2016 at 8:47 am

Can you explain how you are wanting this to work please?

If you are including the custom questions within the registration form I’m not sure why you need to make an ajax call to return the start date and custom fields.

You’ll likely be able to use a hook within EE which passes either the event object or another object you can use to pull in the ID, but it depends what your trying to do.


dcorso

July 26, 2016 at 5:30 pm

I am including a birthdate field, but some events need to have age restrictions like ages 6-12 or 9-12 years old. So I need to get that information for each event to check against the birthdate they enter.

A user enters their birthdate, I need to return what are the allowed age range for that event (custom fields), then see if they are within that age range based on the start date of the event.

As each question group may belong to a different event I need to check each event based on the question group being output. So can’t have a generic piece of jquery. It will need to be dynamic.


Josh

  • Support Staff

July 27, 2016 at 8:41 am

Hi Rachel,

You can pass dynamic data (like the values of custom fields) into your custom JavaScript by using the wp_localize_script() function. Here are a few references that have more information about how it works/how to use it:

http://codex.wordpress.org/Function_Reference/wp_localize_script
https://pippinsplugins.com/use-wp_localize_script-it-is-awesome/http://codex.wordpress.org/Function_Reference/wp_localize_script

Viewing 5 reply threads

The support post ‘Registration Date Validation’ 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.

Event Espresso