Hello,
I'm fairly new to drupal module development and I've been reading up on the new forms API, which I think is great except that I can't get submit and validation hooks to work.
I am using drupal 5.1 with PHP 4.4.4 on Debian etch.
I've written some quick code to illustrate my problem and I'd be grateful for any help. I'm sure I'm missing something trivial.
Test case:
After loading the module, I go to to http://hostname/entry
This displays the form, but when I hit "submit", neither of the two hooks are executed; instead, I get redirected to "/test" right away, which is defined as the '#action' of the form; this in turn displays "blah" (see below).
I'd be glad for any help.
-- tel
<?php
function test_menu($may_cache) {
$items = array();
$items[] = array(
'path' => 'test',
'title' => t('Test Page'),
'callback' => 'test_view',
'access' => 'access test',
'type' => MENU_CALLBACK
);
$items[] = array(
'path' => 'entry',
'title' => t('Test Page - Entry page'),
'callback' => 'test_page',
'access' => 'access test',
'type' => MENU_CALLBACK
);
return $items;
}
function test_perm() {
return array('access test');
}
function test_page() {
return drupal_get_form('test_form');
}
function test_view() {
// TODO
return "blah";
}