title: Drupal Webform Validation (webform_form_alter)
body: <p>I'm doing some webform validation using webform_form_alter. I'm using webform_form_alter because I switch certain content on a "select" field.</p>
  
  <p>In my webform-form-317.tpl.php I defined new fieldsets I set my fields into this new fieldset and unset the original from the webform.</p>
  
  <pre><code>$form['submitted']['ContactInfo'] = array(
  '#type' =&gt; 'fieldset',
  '#prefix' =&gt; '&lt;div id="ContactInfo"&gt;',
  '#suffix' =&gt; '&lt;/div&gt;',
  '#weight' =&gt; -10,
  '#title' =&gt; 'Contact Information'
  );
  
  $form['submitted']['ContactInfo']['phone_home'] = $form['submitted']['phone_home'];
  unset($form['submitted']['phone_home']);
  </code></pre>
  
  <p>in my webform_form_alter I have the following code:</p>
  
  <pre><code>switch ($form_id)
  {
  case 'webform_client_form_317':
  {
  $form['#validate'][] = 'validate_form';
  }
  }
  </code></pre>
  
  <p>My Validate_form function looks like:</p>
  
  <pre><code>function validate_form($form_id, $form_values)
  {
        if ($form_values['submitted_tree']['ContactInfo']['phone_home'] == "")
        {
               form_set_error('phone_error', t('Please enter a home phone number.'));
        }
  }
  </code></pre>
  
  <p>The issue is that the $form_values['submitted_tree']['ContactInfo']['phone_home'] comes back as nothing even is the user has inputted something into the textfield.</p>
  
  <p>Any suggestions on what i'm doing wrong?</p>
  
  <p>As a second question in case somebody also the answers, how do I modify the of these textfields to set the class for "form-text required error" so they show up in red with the rest of the mandatory fields.</p>
  
  <p>Thanks</p>