Closed (fixed)
Project:
Drupal API + Extensions
Version:
5.x-1.0
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
15 Mar 2010 at 15:18 UTC
Updated:
29 Mar 2010 at 15:50 UTC
I am trying to create my own first module, which is a custom form. I have been following some tutorials. I realize that this is not finished, but a form should be displayed when I go /orderonline. Instead I get an "Access Denied" message even when I am superuser. What am I doing wrong?
Thanks,
David
atfr_order.info
; $Id: atfr_order.info,v 1.4 2007/06/08 05:50:57 dries Exp $
name = AT Fundraising Order Module
description = A custom order module for AT Fundraising website
package = Other
version = VERSION
core = 6.x
; Information added by drupal.org packaging script on 2010-03-04
version = "6.16"
project = "drupal"
datestamp = "1267662010"
atfr_order.module
<?php
// $Id: atfr_order.module, v. 1.0 2010/03/13
/**
* Implementation of hook_help().
*/
function atfr_order_help ($path, $arg) {
switch ($path) {
case 'admin/help#atfr_order':
$output = '<p>'. t('This is the help module for the AT Fundraising Order Module. More to come!') .'</p>';
return $output;
}
}
/**
* Implementation of hook_perm().
*/
function atfr_order_perm () {
return array('create order','view own order','view all orders','edit own order','edit all orders');
}
function atfr_order_menu () {
$items = array();
$items['orderonline'] = array(
'title' => t('Order Online'),
'page_callback' => 'orderonline_page',
'access arguments' => array('create order'),
'type' => MENU_SUGGESTED_ITEM,
);
return $items;
}
function orderonline_page () {
return drupal_get_form('orderonline_form');
}
function orderonline_form ($form_state) {
$form = array();
$form['Prefix'] = array(
'#type' => 'select',
'#title' => t('Prefix:'),
'#options' => array(
'Mr.' => t('Mr.'),
'Mrs.' => t('Mrs.'),
'Ms.' => t('Ms.'),
'Dr.' => t('Dr.'),
),
'#description' => t('Select the Prefix of your name.'),
);
$form['Firstname'] = array(
'#type' => 'textfield',
'#title' => t('First Name:'),
'#description' => t('Enter your first name.'),
'#size' => '20',
'#maxlength' => '20',
);
$form['MI'] = array(
'#type' => 'textfield',
'#title' => t('MI:'),
'#description' => t('Enter your MI or middle name.'),
'#size' => '20',
'#maxlength' => '20',
);
$form['Lastname'] = array(
'#type' => 'textfield',
'#title' => t('Lastname:'),
'#description' => t('Enter your last name.'),
'#size' => '30',
'#maxlength' => '30',
);
$form['Suffix'] = array(
'#type' => 'textfield',
'#title' => t('Suffix:'),
'#description' => t('Enter the suffix to your name.'),
'#size' => '10',
'#maxlength' => '10',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit Order'),
);
return $form;
}
Comments
Comment #1
dapperry commentedNever mind. DUmb error: 'page_callback' should have been 'page callback'. Duuuh.