Community

$form_state['values']['field_1'] return NULL value

Hi there,

I'm new in drupal, and i'm trying to validate a form from the "webform module".
I mean:
1. I've added the textfield "field_1" via UI,
2. altereted it via _form_alter,
3. Trying to get the value on submit and verify if it was previously already added
4. If not, display error

/**
* Implements hook_form_validate().
*
*/
function unusual_tournament_form_validate(&$form, &$form_state, $form_id){
// SELECT data FROM webform_submitted_data WHERE nid = 1 AND cid = 2 AND data LIKE field_1
$result = db_select('webform_submitted_data', 'd')
    ->fields('d', array('data'))
    ->condition('nid', 1, '=')
    ->condition('cid', 2, '=')
    ->condition('data', db_like($form_state['values']['field_1']) . '%', 'LIKE')
    ->execute();
  foreach ($result as $row) {
      $matches[$row->data] = check_plain($row->data);
  }
if ($form_state['values']['field_1'] != $matches[$row->data]) {
form_set_error('', t('Warning! \'' . $form_state['values']['field_1'] . '\' is not allowed'));
}

The problem is I can't get anything but Null value from $form_state['values']['field_1']

I am missing something?

!! Just Solved !!
Just solved: I need to pass the parameters like this
$form_state['values']['submitted']['field_1']

nobody click here