By cliffp on
I'm a beginner at Drupal and I'm trying to use the Forms API to build a form for my site. I followed the QuickStart guide and I've delved a little into the API reference. However I have got stuck on implementing the hook_menu for my 'test' module. Below is my code. The problem is that the test page itself works fine, but the form page comes after it just gives a 'Page not found error'.
For example 'http://localhost/mytest' works fine. 'http://localhost/mytest_form' gives page not found.
Any pointers would be appreciated.
Cheers,
Cliff
function mytest_menu() {
$items = array();
$items['admin/settings/mytest'] = array(
'title' => ' my test admin settings',
'description' => 'Description of test module',
'page callback' => 'drupal_get_form',
'page arguments' => array('mytest_admin'),
'access arguments' => array('access administration pages'),
'type' => MENU_NORMAL_ITEM,
);
$items['mytest'] = array(
'title' => 'mytest page',
'page callback' => 'mytest_all',
'access arguments' => array('access test content'),
'type' => MENU_CALLBACK,
);
$item['mytest_form'] = array(
'title' => 'my test form',
'page callback' => 'mytest_myform',
'access arguments' => array('access test content'),
'type' => MENU_CALLBACK,
);
return $items;
}
Comments
I seem to be having the same
I seem to be having the same problem. All the tutorials say "place your form.module file in /modules" and everything should magically work.
I've tried several examples with no success. Permissions problem? Are *.info, *.css required with the module?
___
I believe that an info is needed, so that you can activate your module. I believe that the bare minimum is .info and .module, but I'm still a beginner.
Cheers,
Cliff
____
I know it is bad form to bump one's own post, but I'm getting desperate. I'll not do it again.
I've fiddled with everything that I can think of, read everything that I can find, switched the order of stanzas and tried different URLs and it still won't show the mytest_form form. I just get the message "Page not found".
I even change the callback as follows. No joy.
Any ideas anyone?
Cheers,
Cliff
SOLVED
The third item had a typo. It should read -
$items