Date Picker

3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 8, 2013   (RSS)

By nmsinc - April 7, 2013

Is there a way to use the CMS date picker on pages outside the CMS?

Thanks - NMSINC

nmsinc

By gregThomas - April 8, 2013

Hi NMSINC,

I've done some testing, and this is possible. If you include the following JS and CSS in your header:

<script type="text/javascript" src="/cmsAdmin/3rdParty/jquery/jquery1.4.1.js"></script>
<script type="text/javascript" src="/cmsAdmin/3rdParty/jqueryUI/js/jquery-ui-1.8.18.custom.min.js"></script>
<link   type="text/css"       href="/cmsAdmin/3rdParty/jqueryUI/css/smoothness/jquery-ui-1.8.18.custom.css" rel="stylesheet" />

Then add the following input and JavaScript where you want the field to appear:

<input id="datePicker" type='text' name='date_max' value=''  />
<script type='text/javascript'>
  $(function() {
    if ($.datepicker != undefined) {
      $('#datePicker').datepicker({
        showOn: 'button',
        buttonImage: '/cmsAdmin/3rdParty/jqueryUI/calendar.gif',
        buttonImageOnly: true,
        dateFormat: 'yy-mm-dd 00:00:00'
      });
    }
  });
</script>

You can move the JavaScript code to where ever you want on the page. 

Let me know if you have any questions. 

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com