Hi

I am developing a module with a form. I have installed the jquery calendar module. But I am not able to figure out how to add the calendar popup to a text field.

Advance thanks for the help.

Karthik

Comments

vwX’s picture

$(document).ready(function(){
popUpCal.setDefaults({autoPopUp: 'button', buttonImageOnly: true, buttonImage: 'calendar.gif', buttonText: 'Calendar'});
$('css selector to select what field(s) you want to add the calendar too.').calendar();
}

In a javascript file.

Then use drupal_add_js to add let the module make use of the jquery javascript.

Have fun and check my Drupal Profile: http://drupal.org/user/519

svogel’s picture

Hi,

I assume you mean the jscalendar which is available inside the jstools-module.

In the README.txt there is a smal hint. You simply have to set the #attributes of your textfield like this:

  $form['date'] = array(
    '#type' => 'textfield',
    '#attributes' => array('class' => 'jscalendar'),
  );

Best regards
Stefan