1

Question

After a user has a submitted a form how do I determine how to reference individual form field values in $form_state['values'] ?

Examples

For example, I have several fields in my form, such as 'field_organization' that would normally be accessed (for CSS) purposes, like so:

$form['customer_profile_billing']['field_organization']

I have others in my form that have even more convoluted paths such as

['und'][0]['another-name']['a-fourth-name'], etc.

1

You can access $form_state['values'] of a field in like

$variable = $form_state['values']['your_field_name'];

After saving you can access like this

$variable = $form['your_field_name']['und'][0]['value']; 

For more information please check

  1. $form_state keys
  2. What is $form_state used for ?

Hope this will help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.