This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

dates before 1970

Minor issue:

The function node_validate in node.module doesn't allow nodes to have a negative 'created' field.
It's very limiting for my project, and I don't understand the motivation.

Couldn't the following line...

if (strtotime($node->date) <= 0) {ù

... be changed to

$created = strtotime($node->date);
if ($created === -1 || $created === FALSE) {

Not sure I should have posted here... but thank you!
Ciao. Mic

how to put image field in new module?

What is the best way to add an image field to a new node type module I am making? Should I use img_assist.module? Or just a form input field of
'#type' => 'file'
? Or what? Thanks!
dado

Mirroring user and profile db functions in external db

I'd like to attach a db to my drupal site. I am hoping to be able to somehow mirror drupal's user and profile insert/update/delete db on this external db so that they are in synch. In otherwords, a user registering on the site is automatically registered on the external db: same username, password and any profile info collected. Of course, any updates and deletes also need to be reflected.

Sunrise: my new module

I just finished my new module for Drupal 4.6: Sunrise. It displays a block where users can see the sunrise and sunset times for a predefined geographical location. Please post feedback and guidelines for the next version. :)

form api: return $form vs. $output

Hi!

I already read the handbook pages about 4.7's new form api, but I still dont understand how to use it
correctly. I wrote a simple test module to play with the api:

function formtest_settings() {

  $form['global'] = array(
    '#type' => 'fieldset',
    '#title' => t('form_group'),
  );

  $form['global']['formtest_enable'] = array(
    '#type' => 'radios',
    '#title' => t('Test Radios'),
    '#default_value' => variable_get('formtest_enable', 0),
    '#options' => array(t('Off'), t('On')),
  );  
  
  $options = array();
  $options[0] = "Choose Option";
  $options[1] = "Option A";
  $options[2] = "Option B";
  
  $form['global']['formtest_method'] = array(
    '#type' => 'select',
    '#title' => t('Test Select'),
    '#default_value' => 1,
    '#options' => $options,
    '#description' => t('Sample Desciption'),
  );
  
  //$output = form_render($form);
  //$output = drupal_get_form('testform', $form);
  //return $output;
  return $form;
  
}

The code works nicely with return $form, but when I try one of the other lines and return $output
I receive "Fatal error: Cannot use string offset as an array in ...\system.module on line 728"
Whats wrong with my code? What function should I use form_render or drupal_get_form?

As long I must use return $form, I'm unable to apply special format to my output,
e.g. $output = theme('table', $header, $rows) is not possible then.

Hoping for help, Thilo

My implementation of inline forms for Drupal 4.7

Hello everybody =)

I'm developing an ajax widget that runs on Drupal 4.7 to easily implement inline forms (note: this is different from autocomplete. A good inline form example is http://www.baekdal.com/x/xmlhttprequest/). It is already basically running, but using xajax as library (along with the xajax module from CVS). I don't have the primary intention to be merged to the core (and that's why I'm using xajax -- and we know that 3rd party libraries don't get merged into the core). I would like to know if 1) is this something that interests everybody and deserves to be developed using the core stuff for ajax instead of xajax and 2) is there anobody here already working with inline forms. If somebody thinks that this will be useful to be published, let me know =)

Currently, to make your form "inline", you need to setup a 3rd callback called _inline, that will handle the field changes. So, let's suppose that you have a simple form with : "Name", "E-mail", "Login" and "Password" and you want to let the user know if the login is already taken in real time (as in gmail and others), and your form is called "user_register".

drupal_get_form('user_register', $formfields);

and you have the default callbacks (_submit and _validate)

function user_register_submit($form_id, $values) { }
function user_register_validate($form_id, $values) { }

and on my model, you create a 3rd one

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions