Sagarmichael
Sagarmichael

Reputation: 1624

#value not being changed in custom drupal form

I have created a custom drupal 7 form with a submit button. when submit is pressed the values in $form_state['values'] are not changed. see the code below:

  $form[$tag] = array(
  '#title' => t($tag),
  '#type' => 'textfield',
  '#default_value' => !empty($form_state['values'][$tag]) ? $form_state['values'][$tag] : $value,
 );

 $form['actions'] = array('#type' => 'actions');
  $form['actions']['submit'] = array(
  '#type' => 'submit',
  '#value' => t('Submit'),
  '#weight' => 5,
  '#submit' => array('xml_form_builder_edit_datastream_form_submit'),
  );

Then the submit function is:

 function xml_form_builder_edit_datastream_form_submit($form, &$form_state){

    dsm('SUBMITTED');
    dpm($form);
    dpm($form_state);
    dsm('SUBEND');
}

the $form_id is 'xml_form_builder_edit_datastream_form'.

Ive been trying to figure this out for a good few hours.

Anyone got any ideas?

Upvotes: 0

Views: 84

Answers (1)

prabeen giri
prabeen giri

Reputation: 803

Try $form_state['input'][$tag] , that should have the user input value.

Upvotes: 1

Related Questions