Skip to main content
edited tags
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
added 239 characters in body
Source Link
st2014
  • 43
  • 2
  • 9

I am using Drupal 7 webform api, have a created a field in my _form_alter hook in a custom module, but while on page load the hidden field contains the correct value, when I submit the form it does not save to the mysql table, and gives me an empty cell

$form['State'] = array(
  '#type' => 'hidden',
  '#value' => 'Unread',
  '#attributes' => array('id' => array('stateform')),    
);

How can I make it save to the mysql table on submit?

UPDATE:

$form['State'] = array(
'#type' => 'hidden',
'#title' => t('Hidden'),    
'#attributes' => array('id' => array('state')),
);
drupal_add_js(drupal_get_path('module','mymodule') . '/js/custom.js');

I am using Drupal 7 webform api, have a created a field in my _form_alter hook in a custom module, but while on page load the hidden field contains the correct value, when I submit the form it does not save to the mysql table, and gives me an empty cell

$form['State'] = array(
  '#type' => 'hidden',
  '#value' => 'Unread',
  '#attributes' => array('id' => array('stateform')),    
);

How can I make it save to the mysql table on submit?

I am using Drupal 7 webform api, have a created a field in my _form_alter hook in a custom module, but while on page load the hidden field contains the correct value, when I submit the form it does not save to the mysql table, and gives me an empty cell

$form['State'] = array(
  '#type' => 'hidden',
  '#value' => 'Unread',
  '#attributes' => array('id' => array('stateform')),    
);

How can I make it save to the mysql table on submit?

UPDATE:

$form['State'] = array(
'#type' => 'hidden',
'#title' => t('Hidden'),    
'#attributes' => array('id' => array('state')),
);
drupal_add_js(drupal_get_path('module','mymodule') . '/js/custom.js');
Source Link
st2014
  • 43
  • 2
  • 9

How to send hidden field value to db on webform submit

I am using Drupal 7 webform api, have a created a field in my _form_alter hook in a custom module, but while on page load the hidden field contains the correct value, when I submit the form it does not save to the mysql table, and gives me an empty cell

$form['State'] = array(
  '#type' => 'hidden',
  '#value' => 'Unread',
  '#attributes' => array('id' => array('stateform')),    
);

How can I make it save to the mysql table on submit?