How to override form just on one page?

Posted by user363036 on Stack Overflow See other posts from Stack Overflow or by user363036
Published on 2010-06-14T01:22:47Z Indexed on 2010/06/14 1:32 UTC
Read the original article Hit count: 272

Filed under:
|
|
|

OK so this is my hook form alter function.It is causing all the registration forms on site to be over written which I do not want as I just want it on this page.

 
function special_registration_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'user_register') {
    drupal_set_title(t('Custom registration'));
    $form['firstname'] = array('#type' => 'textfield', 
                               '#title' => t('First Name: *'), 
                               '#required' => TRUE, 
                               '#size' => 45, 
                               '#weight' => - 100,);
    $form['lastname'] = array('#type' => 'textfield', 
                              '#title' => t('Last Name: *'), 
                              '#required' => TRUE, 
                              '#size' => 45, 
                              '#weight' => - 99,);
  }
I only first name and last name to be captured and stored in a different table just on this page.

On other pages I just want the good old fashioned form. Do I still need to change the weight? I know I am missing something elementary.

© Stack Overflow or respective owner

Related posts about php

Related posts about drupal