Support

Home Forums Event Espresso Premium Implementing Birth Date date picker question

Implementing Birth Date date picker question

Posted: September 16, 2014 at 2:17 pm


Michel Cazarin

September 16, 2014 at 2:17 pm

Hello.

I need to implement a date picker as a question for “when did you born?” .. can you please tell me how i can do this on the registration form??

Thanks


Josh

  • Support Staff

September 16, 2014 at 4:36 pm

Hi Michel,

If you have Event Espresso 4, this can be done by adding a new question and selecting the Date Question Type. [link to a video that shows how to add a question to a registration form](http://screencast.com/t/0n0Y5D0I)

The Date picker feature isn’t available in Event Espresso 3, but could be added by a developer familiar with extending WordPress plugins.


Michel Cazarin

September 16, 2014 at 5:40 pm

Thank you Josh

Could you tell me which would be the code to add, in which file??… i know i can add it with some jquery code … i just need to know where to put it. Please im using EE3, and i think this is a basic question on a form plus my client is all over my back!.. please some help! Thank you


Sidney Harrell

September 17, 2014 at 3:20 pm

You would need to enqueue the datepicker jquery extension: http://jqueryui.com/datepicker/. There’s some code here that will do that: https://wordpress.org/support/topic/how-to-add-jquery-datepicker. You’ll need to modify it to use the input field of your custom question.


Josh

  • Support Staff

September 17, 2014 at 3:33 pm

Hi Michel,

Here are a few more tips:

Use the wp_enqueue_script() function to make sure they load with no conflicts.

http://codex.wordpress.org/Function_Reference/wp_enqueue_script

The handle for jQuery UI Core is jquery-ui-core.

The handle for jQuery UI Datepicker is jquery-ui-datepicker.

To ensure that these load on an Event Espresso page, you add this to your site functionality plugin, or into /wp-content/uploads/espresso/templates/custom_functions.php

add_action('wp_enqueue_scripts', 'my_custom_espresso_scripts');

function my_custom_espresso_scripts() {
	global $load_espresso_scripts;

	if ( ! $load_espresso_scripts )
		return;
	// load jQuery UI scripts from WP Core
	wp_enqueue_script('jquery-ui-core');
        wp_enqueue_script('jquery-ui-datepicker');
       // optionally enqueue up a jQuery UI stylesheet here

}

Then you’ll need to use Firebug or its equivalent to find the text input’s class name. In this example, the class name for the input to add a datepicker to is TEXT_13:

add_action('wp_footer', 'my_custom_datepicker_input');

function my_custom_datepicker_input() {
	global $load_espresso_scripts;

	if ( ! $load_espresso_scripts )
		return;

?>	
	


			
		


Michel Cazarin

September 17, 2014 at 9:16 pm

Ok so…

I have manage to activate the Date Picker question in the “Question” section, and i even add it to a group of questions.
The problem is that it doesnt appear in the frontend of the form … what i am missing??
Thank you all for your responses!!! Appreciate it a lot!!


Dean

September 18, 2014 at 3:31 am

Hi,

Sorry there was a typo above, the custom_fucntions.php file should go in wp-content/uploads/espresso/

NOT in the wp-content/uploads/espresso/templates folder.

The support post ‘Implementing Birth Date date picker question’ 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