I am trying to make my own form from the cck API , I have rendered all cck inputs but when i press submitt button it doesn't submit , it just refreshes and nothing is added/published
Here is the code.

//added lines in the template.php
function magazeen_theme($existing, $type, $theme, $path) {
  return array(
    'sweepstake_node_form' => array(
        'arguments' => array('form' => NULL),
        'template' => 'node-sweepstake-edit'
    )
  );
}

the form

    $form['buttons']['submit']['#value'] = 'Submit Sweepstake';
     $form['buttons']['preview']['#access']= FALSE;
    
     //print drupal_render($form);
   
    print drupal_render($form['buttons']);

?>

there are other input forms textfields,select lists and cck_other_select/cck_other_textfield

PLEASE HELP!!

Comments

thekevinday’s picture

Project: CCK Accessibility » Content Construction Kit (CCK)
Version: 6.x-1.0 » 6.x-2.9
Component: Code » General
Priority: Critical » Normal

I believe what you need to do is implement a hook_menu(), like:

<?php
/**
 * Implementation of hook_menu().
 */
function my_menu() {
  $menu = array(
    'path/to/my/form' => array(
      'title' => 'My Form',
      'description' => 'An example form',
      'access arguments' => array('Access My Form'),
      'page callback' => 'drupal_get_form',
      'page arguments' => array(my_form_function'),
    ),
  );

  return $menu;
}
?>

Then build your form structure in a function called 'my_form_function()'.
Then build two more functions: 'my_form_function_validate($form, &$form_state)'
Then build two more functions: 'my_form_function_submit($form, &$form_state)'

I believe trying to add a submit button inside a theme is not the proper place.
You should review the CCK Forms API.

I am going to put you in the proper project request area.