2

I've been searching high and low and have been unable to find a basic guide for including the EE datepicker on a custom field in a Channel Form.

What code do I need to add to the following to add a datepicker to the input field?

    {exp:channel:form channel="event_public" return="/" datepicker="yes" }
...
      <label for="event_date">Date*</label><br />
      <input type="text" name="event_date" id="event_date" value="{event_date}" maxlength="23" size="25"><br />
...
    {/exp:channel:form}

Thanks!

Randy

2 Answers 2

0

I am pretty sure you need to add the datepicker class to the input. By default, that's the selector that is used for instantiate the jQuery datepicker widget.

3
  • Thanks! I think that was what I needed, but it's still not working—I'm getting a JS error within the datepicker code that's automatically added. It's on this line: $.datepicker.setDefaults({dateFormat:$.datepicker.W3C+EE.date_obj_time}); The error says "Cannot read property W3C of undefined." Any ideas?
    – Randy
    Commented Oct 10, 2013 at 18:03
  • Sounds like an EE bug. $.datepicker is not getting defined for some reason. Commented Oct 10, 2013 at 20:08
  • I get that error when I use my own JQuery, and then Safecracker adds its own too. If you do not use your own JQuery and add the datepicker class, it should work, but if you do use your own JQuery, then I dont know how to include the datepicker. Commented Dec 4, 2013 at 16:26
2

I think it's automatically included if you make sure to have the channel form css linked:

<link href="{path=css/_ee_channel_form_css}" type="text/css" rel="stylesheet" media="screen">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.