I'm new to drupal, and especially new to drupal form API. I see all the documentation which seems to make sense. They miss one key instruction that you need to create .module / .info files. I have created those, and copied the code from into my module Form example code drupal 6 However, I don't know how to view the module.
I know that if I can get a working example, I will be fine, but I can't. I am lost, and no matter how far I search all the guides miss the early steps, or make too much of an assumption.
test_form.info
name = Form example
description = My form example form API.
core = 6.x
package = Example form
test_form.module
function MYMODULE_menu() {
$items['some/form'] = array(
'title' => 'Some Form',
'access arguments' => array('access content'),
'page callback' => 'drupal_get_form',
'page arguments' => array('MYMODULE_some_form'),
);
return $items;
}
function MYMODULE_some_form($form_state) {
$form['item'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#required' => TRUE,
'#default_value' => 'Default...',
);
return $form;
}
examples/form_example/tutorial
for example? Do you get an error? A 404? Have you defined theform_example_tutorial_1
callback and placed it in your module file? Sorry for the barrage of questions but with the limited code in your question any answer would just be a wild guessfunction form_example_tutorial_1($form, &$form_state) {
. That will contain the code to define you form (remember toreturn $form
at the end). Then it's just a matter of clearing Drupal's caches, because menu paths (or router items as they're sometimes known) are cached for performance reasons. After that it should work, in theory. If it doesn't, isolate the smallest bit of code you can that you think should work and post that here :)http://mysite.com/index.php?q=some/path