Drupal Studs help me with my form_alter hook ( I am almost there)

Posted by user363036 on Stack Overflow See other posts from Stack Overflow or by user363036
Published on 2010-06-10T19:29:59Z Indexed on 2010/06/10 19:32 UTC
Read the original article Hit count: 299

Filed under:
|
|

So I think I am almost there conceptually but need some missing pointers.

Objective is to add a few more fields to the normal user registration form, style it a little, then submit it with storing the extra fields in a table.

This is what I have so far. Can someone give me the final nudge and get me going. Please help me. Also how do I apply some minor styling like aligning the new form fields ?

Thank you so much !!!!!!!!!

  function module_menu() {
$items = array();
$items['school/registration'] = array(
      'title' => 'Upgraded Registration Form',
      'page callback'    =>'module_school_register',
      'type' => MENU_CALLBACK
);

return $items; }//end of the function

function module_school_register(){ return drupal_get_form('form_school_register'); }//end of the function

function module_school_form_alter(&$form, $form_state, $form_id) {

dsm($form_id);

if ($form_id == 'user_registration_form') { // modify the "#submit" form property by prepending another submit handler array $form['#submit'] = array_merge( array('_module_registration_submit' => array()), $form['#submit'] );

} }

function _module_registration_submit($form_id, $form_values) { // store extra data in different table }

function module_registration_validate($form, &$form_state) { $error=0; //Validation stuff here, set $error to true if something went wrong, or however u want to do this. Completely up to u in how u set errors. if ($error) { form_set_error('new_field_name', 'AHH SOMETHING WRONG!'); } }

© Stack Overflow or respective owner

Related posts about drupal

Related posts about drupal-6