Community & Support

It is amazing how difficult it is just to make a normal form in Drupal even after you follow tutorials

Error I get is : Skipping broken view

Contents of my Module file:

function modulename_menu() {
$items = array();
$items['some/place'] = array(
      'title' => 'Some title',
      'page callback'    =>'quiz_page',
      'type' => MENU_CALLBACK           
    );

return $items;
}//end of the function

function quiz_page () {
  return drupal_get_form('quiz_form');
}



function quiz_form ($form_state) {
  $form = array();
 
  //make a texfield
  $form['name'] = array (
    '#type' => 'textfield',
    '#title' => t('Please enter your name'),
    '#required' => TRUE,
  );
 
  //a pair of "radio buttons"
  $form ['toast'] =array (
    '#type' => 'radios',
    '#title' => t('Do you like toast?'),
    '#options' => array (t('No'), t('Yes')),
  );
 
  //a "submit" button
  $form['submit'] = array (
    '#type' => 'submit',
    '#value' => t('Make it so...'), 
  );
 
  // If you forget this line your form will never exist
  return $form;
}

Comments

Do you have the quiz module

Do you have the quiz module installed by chance?

Other wise the form looks good though as a matter of best practices all your functions should start with you module name to avoid name collisions.

Does the form even show?

I had to enter the : 'access

I had to enter the :

'access arguments' => array('access content')

in my menu call and it then displayed.

Now the challenge is to arrange the form fields in 2 columns instead of 1. Any ideas ?

nobody click here