Drupal 7 Custom Content form_alter validation Hi I was wondering if anyone could give me some advice on this.
Basically what I have is a custom content type created by the content creator GUI, I am writing a custom module to alter the appearance and values of the content form. 

like so:

function sswap_content_validation_form_alter(&amp;$form, $form_state, $form_id) 
{ 
if (isset($form['type']) &amp;&amp; isset($form['#node'])) 
{

if ($form_id == 'advertise_node_form') 
{

  // Unset the options we don't want user to see.
  unset($form['menu']);
  unset($form['comment_settings']);
  unset($form['revision_information']);
  unset($form['author']);
  unset($form['options']);
  unset($form['path']);

  $form['#after_build'][] = '_surplus_cck_form_alter';

  // we need to tell the form to follow a validation function
  $form['#validate'][] = '_surplus_cck_validation';
  $form['#submit'][] = '_surplus_cck_submit';
    }
  }
}


This all works fine and I am able to alter values in the form_alter section as expected, however once I get to the _surplus_cck_validation custom function I am unable to change values, basically what I am doing is checking if a value is X if not I'll replace it with something more suitable after some processing. At this point I can't even change X to a static string though.

To alter my form content I am using:

$form['field_adpostcode']['und'][0]['value']['#value'] = 'TESTING';
$form['field_adpostcode']['und'][0]['#value']['value'] = 'TESTING';


These lines do actually work in the form_alter part as mentioned. I should also note the function for surplus_cck_validation is being called I have experimented with a few echos and notices, and the $form and &amp;$form_state are being passed to it also.

Any help on this would be greatly appreciated I've spent the last few hours trying different things and digging down into the form structure with dsm and debug, but can't seem to find what I need.
Perhaps try $form_state.

$form_state['field_adpostcode']['und'][0]['value']['#value'] = 'TESTING';
$form_state['field_adpostcode']['und'][0]['#value']['value'] = 'TESTING';


I suspect the array structure is different but you get the idea.