Get the value of the selected field in Drupal Form API -


i have custom content type called events has few fields defined in it.

the field name field_store_name. can options these check boxes using code:

$form['field_store']['und']['#options'] 

this how option(s) selected/checked. correct way of doing this?

$form_state['build_info']['args']['0']->field_store['und'] 

thanks

when user submits form custom submitter called. add custom form submitter form should use:

/* implements hook_form_alter(). */ function modulename_form_alter($form, $form_state) {   // ...   $form['#submit'][] = 'modulename_submittername';   // ... } 

so in custom submitter have submitted values under $form_state['values']:

function modulename_submittername($form, $form_state) {   dpm($form_state['values']); } 

this index apper in $form_state array when submit form , contain submitted values. $form array still contain default values shown @ form before you've changed them , submitted form.

read more:

value need should $form_state['values']['field_store]['und'][0].


Comments