After losing a good deal of sleep and hair, I'm coming back to the forum to try to get help. I'm customizing a user registration form for this site: http://anisa.org.za/user/register

I am using a Zen subtheme in D6.

There are three requirements:
1. Reorganize the layout of the form to a more logical organisation of information. -- accomplished
2. Hide the name_first and name_last fields from the "Required Patron Fields" fieldset.
3. Pass the data from the profile_first_name and profile_surname fields to the name_first and name_last fields.

The problem is that the form simply doesn't submit any information to the site. When you press "Submit", it simply reloads the form. Since it isn't passing along error messages, I'm guessing that there is a field that I've missed somewhere, but I frankly have no idea where that might have happened. Any help on this matter is appreciated!!!

Here is my template.php file:

/**
 * Implementation of HOOK_theme().
 */
function anisa_theme(&$existing, $type, $theme, $path) {
  $hooks = zen_theme($existing, $type, $theme, $path);
  /* Override the user-registration form */
  $hooks['user_register'] = array(
    'template' => 'user-register',
    'arguments' => array('form' => NULL)
  );
  return $hooks;
}

/* Override the registration form */
function anisa_theme_preprocess_user_register(&$vars,$hook) {
  $vars['form']['Required Patron Fields']['name_first']['#type'] = 'hidden';
  $vars['form']['Required Patron Fields']['name_last']['#type'] = 'hidden';
  //remove the patron fields
  unset($vars['form']['Required Patron Fields']['name_first']);
  unset($vars['form']['Required Patron Fields']['name_last']);
  $vars['rendered'] = drupal_render($vars['form']);
}

Here is my user-register.tpl.php file:

<div id="registration_intro">
  <p>By filling out this form and registering on the ANiSA website, you are also becoming a member. For more information about becoming an ANiSA member, visit the <a href="join">Join the ANiSA Community page</a>. For more information about the Terms of Service, <a href="tos">click here</a>, and for information about our privacy policies, <a href="privacy">click here</a>.</p>

  <p>ANiSA membership is intended for individuals, not for organisations. If your organisation wishes to become an ANiSA Affiliate, please consult the information in the column to the right.</p>

  <p>Required fields are marked with a red asterisk(<span style="color:#c00;">*</span>). Your information is protected by our <a href="privacy">Privacy Policy</a> and will only be revealed to other members with your consent.</p>
</div><!-- /#registration_intro -->

<div id="registration_wrapper">
  <div id="registration_personal">
    <div id="registration_surname">
      <?php print drupal_render($form['Personal Information']['profile_surname']); ?>
    </div><!-- /#registration_surname -->
    <div id="registration_first_name">
      <?php print drupal_render($form['Personal Information']['profile_first_name']); ?>
    </div><!-- /#registration_first_name -->
    <div id="registration_profile_name">
      <?php print drupal_render($form['Personal Information']['profile_name']); ?>
    </div><!-- /#registration_profile_name -->
    <div id="registration_name">
      <?php print drupal_render($form['account']['name']); ?>
    </div><!-- /#registration_name -->
    <div id="registration_email">
      <?php print drupal_render($form['account']['mail']); ?>
    </div><!-- /#registration_email -->
    <div id="registration_telephone">
      <?php print drupal_render($form['Personal Information']['profile_telephone']); ?>
    </div><!-- /#registration_telephone -->
  </div><!-- /#registration_personal -->
  <div id="registration_postal">
    <h3>Postal Address</h3>
    <p class="tight">A postal address is required in order to send you the quarterly ANiSA newsletter.</p>
    <div id="registration_postal_address">
      <?php print drupal_render($form['Postal Address']['profile_postal_address']); ?>
    </div><!-- /#registration_postal_address -->
    <div id="registration_postal_city">
      <?php print drupal_render($form['Postal Address']['profile_postal_city']); ?>
    </div><!-- /#registration_postal_city -->
    <div id="registration_postal_post_code">
      <?php print drupal_render($form['Postal Address']['profile_postal_post_code']); ?>
    </div><!-- /#registration_postal_post_code -->
    <div id="registration_postal_province">
      <?php print drupal_render($form['Postal Address']['profile_postal_province']); ?>
    </div><!-- /#registration_postal_province -->
    <div id="registration_postal_country">
      <?php print drupal_render($form['Postal Address']['profile_postal_country']); ?>
    </div><!-- /#registration_postal_country -->
  </div><!-- /#registration_postal -->
  <div id="registration_residential">
    <h3>Residential Address</h3>
    <p class="tight">A residential address is only required if you wish to use the ANiSA Peace Library and Resource Centre.</p>
    <div id="registration_residential_address">
      <?php print drupal_render($form['Residential Address']['profile_residential_address']); ?>
    </div><!-- /#registration_residential_address -->
    <div id="registration_residential_city">
      <?php print drupal_render($form['Residential Address']['profile_residential_city']); ?>
    </div><!-- /#registration_residential_city -->
    <div id="registration_residential_post_code">
      <?php print drupal_render($form['Residential Address']['profile_residential_post_code']); ?>
    </div><!-- /#registration_residential_post_code -->
    <div id="registration_residential_province">
      <?php print drupal_render($form['Residential Address']['profile_residential_province']); ?>
    </div><!-- /#registration_residential_province -->
    <div id="registration_residential_country">
      <?php print drupal_render($form['Residential Address']['profile_residential_country']); ?>
    </div><!-- /#registration_residential_country -->
  </div><!-- /#registration_residential_address -->
  <div id="registration_membership">
    <h3>Membership Details</h3>
    <div id="registration_membership_box">
      <?php print drupal_render($form['Membership Statement']['profile_member_applicant']); ?>
    </div><!-- /#registration_membership_box -->
    <div id="registration_library">
      <?php print drupal_render($form['Membership Statement']['profile_library_applicant']); ?>
    </div><!-- /#registration_library -->
    <div id="registration_membership_statement">
      <?php print drupal_render($form['Membership Statement']['profile_membership_statement']); ?>
    </div><!-- /#registration_membership_statement -->
  </div><!-- /#registration_membership -->
<?php
  $vars['form']['Required Patron Fields']['name_first']['#value'] = $vars['form']['Personal Information']['profile_first_name']['#value'];
  $vars['form']['Required Patron Fields']['name_last']['#value'] = $vars['form']['Personal Information']['profile_surname']['#value'];
  print drupal_render($form['Required Patron Fields']);
?>
  <?php print drupal_render($form['captcha']); ?>
  <?php print drupal_render($form['validate']); ?>
  <?php print drupal_render($form['submit']); ?>
</div><!-- /#registration_wrapper -->

Comments

zanlus’s picture

I added the following two fields to user-register.tpl.php:

  <?php print drupal_render($form['form_id']); ?>
  <?php print drupal_render($form['form_build_id']); ?>

Now the validation happens, but it is registering that the name_first and name_last fields are not filled in. They should be hidden and it doesn't seem to matter whether I set the requirement field to 'false' in template.php or not.