Form Building Error

2 replies [Last post]
Last seen: 10 years 44 weeks ago
Joined: 2011-08-04

I have copied over the code from step 1 in the form building video. The code looks like this:


// $Id$

* @file
* Demonstrates use of the Form API.

* Implements hook_menu().

function input_menu()

$items['input/examples'] = array(

'title' => 'Form API examples',

'description' => 'Example of using the Form API.',

'page callback' => 'drupal_get_form',

'page arguments' => array('input_simple_form'),

'access callback' => TRUE,


return $items;


* A simple form.

function input_simple_form($form, &$form_submit)

$form['color'] = array(

'#title' => t('Favorite color'),

'#type' => 'textfield',

'#required' => TRUE,

'#description' => t('What is your favorite color? Blue? No, wait-'),


$form['submit'] = array(

'#type' => 'submit',

'#value' => 'Submit',


return $form;




// $Id$

* @file

  • Admin page callback for the scaffolding module.

* Builds and returns the scaffolding settings form.

function input_admin_settings()

$form['input_example_setting'] = array(

'#type' => 'textarea',

'#title' => t('Example setting'),

'#default_value' => variable_get('input_example_setting' ''),

'#description' => t('This is an example setting.'),

'#required' => TRUE,


return system_settings_form($form);


; $Id:$
name = Beginning Forms
description = "A start on forms."
core = "6.x"

This throws the error:
warning: Missing argument 2 for input_simple_form() in C:\xampp\htdocs\drupal-6.22\sites\all\modules\input\input.module on line 51.

The only thing I can think of that I have done differently is that I am using drupal 6.22 rather than drupal 7. Is it possible that the code that takes care of the call expects 2 parameters in drupal 7, but only 1 parameter in drupal 6.22?

Chris Shattuck
Last seen: 9 weeks 5 days ago
Joined: 2009-08-16
Hi there, Good question,

Hi there,

Good question, you're right about the issue being that you're using Drupal 6, which only takes one parameter for a form render array function. There were some changes to the Form API in Drupal 7 so applying the examples directly will not work properly. The general ideas are mostly the same, and the code is very similar, but you'll run into issues like you see above.

I hope that helps!

Last seen: 8 years 9 weeks ago
Joined: 2011-09-12
you are missing a comma

Instead of

'#default_value' => variable_get('input_example_setting' ''),

You should write

'#default_value' => variable_get('input_example_setting', ''),

Notice the comma between the first and second parameter in variable_get function call.

Add to playlist

Add to , or

Add to new playlist:

Add to playlist
This is a member-only feature
But, it's easy to become a member

Add to cart:

Contact us

Below are the supported keyboard shortcuts for our video player.

Start / stop video
Go to next video
Go to previous video
Increase or decrease player speed by 20%
Skip ahead or go back by 15 seconds
Jump to a percentage (2 is 20%, for example)
Toggle full screen
Videos Pricing More Search
BuildAModule Logo Icon BuildAModule Logo Icon
Become a member!
1 month
6 months
10% off
12 months
20% off
All memberships come with the following:
24 / 7 access to the entire 1800+ video library
An innovative video player with a rolling transcript
Extensive Drupal and cross-platform training
A thorough and thoughtful training style
Progress tracking
Take notes on specific video sections
Intuitive multi-user management
How many users?
Go solo with a single user, or give multiple team members access through one account and get discounts by bundling multiple users into a single membership.