Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
thekevinday CreditAttribution: thekevinday commentedI believe what you need to do is implement a hook_menu(), like:
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.