How do I add a new flexinode or cck type that automatically uses the js.tools calendar popup?

Afn - December 18, 2006 - 21:16

How do I add a new flexinode or cck type that automatically uses the js.tools calendar popup?

It sounds like it would be simple to do. One for Date and Time, and One for Time only, if possible.

Regards,

Dave

I second the motion

victorkane - December 18, 2006 - 21:51

I am very interested in the answer to this question.

In my case, dealing with Drupal 5.0 rc1.

I hacked the CCK Date module/plugin so that it would automatically use jscalendar, by adding the appropriate fields to the form element (as per instructions), plus some further hacking to solve problems occuring in another part.

I am going to make a test one of these days with a fresh installation, and post the details in the issue queue of the module (if no-one else has already done so); but if there are better instructions here, I would love to hear about it.

Haven't had time to check out the date-range module plugin for Drupal 5.0, either, which says it uses the plugin. Go to modules by name, and choose 5.x.

Victor Kane
http://awebfactory.com.ar

you could use form_alter and

Steve McKenzie - December 18, 2006 - 23:58

you could use form_alter and just add the jscalendar class to the fields you want.

<?php
hook_form_alter
($form_id, &$form) {
  if (
$form_id == 'whatever') {
   
$form['whatever']['#attributes']['class'] = 'jscalendar';
  }
}
?>

i did this on a recent project.

great idea

victorkane - December 19, 2006 - 12:53

thanks!

I am new to Drupal

Afn - December 21, 2006 - 00:47

<?php
hook_form_alter
($form_id, &$form) {
  if (
$form_id == 'whatever') {
   
$form['whatever']['#attributes']['class'] = 'jscalendar';
  }
}
?>

Where do you insert this code? in what module?

If I have a textbox that I want to use jscalendar with, on form "Flexinode-4", and the textbox is called "start_date" where do I put this code to enable the popup calendar?

Please help!

Thanks!

 
 

Drupal is a registered trademark of Dries Buytaert.