I am developing a custom module by name 'form' in drupal 7. I have placed my module folder in sites\all\modules\form. And i have 2 files in 'form' folder. 'form.info' and 'form.module'.
'form.info'
name = Form
description = Form creation.
core = 7.x
And 'form.module' contains
<?php
function form_menu()
{
$items['form/examples'] = array
(
'title' => 'Form API Examples',
'description' => 'Examples of using the Form API',
'page callback' => 'drupal_get_form',
'page arguments' => array('form_simple_form'),
'access callback' => TRUE
);
return $items;
}
function form_simple_form($form, &$form_submit)
{
$form['color'] = array
(
'#title' => t('Favorite Color'),
'#type' => 'textfield',
'#required' => TRUE,
'#description' => t('What is the favorite color?'),
);
$form['submit'] = array
(
'#type' => 'submit',
'#value' => 'Submit',
)
return $form;
}
I am getting only blank white page when i click on the link.
Thanks in advance.
I works for me try this code for mymodule.module
<?php
// $Id$
function form_menu()
{
$items['form/examples'] = array
(
'title' => 'Form API Examples',
'description' => 'Examples of using the Form API',
'page callback' => 'drupal_get_form',
'page arguments' => array('form_simple_form'),
'access callback' => TRUE
);
return $items;
}
function form_simple_form($form, &$form_submit)
{
$form['color'] = array
(
'#title' => t('Favorite Color'),
'#type' => 'textfield',
'#required' => TRUE,
'#description' => t('What is the favorite color?'),
);
$form['submit'] = array
(
'#type' => 'submit',
'#value' => 'Submit',
);
return $form;
}
When you create mymodule.info file
name = Form
description = Form creation.
core = 7.x
package = Form
Add package to it so you have your module in his own box. It is easier to find it betwen all of those modules.