1

Im trying to add additional options for webform component but I seem to be unable to read the data out. I successfully managed to save the data into "extra" inside the db. But I'm unable to read it out again.

what I basically did is this:

function webform_maxlenght_form_webform_component_edit_form_alter(&$form, &$form_state, $form_id) {
$form['extra']['message'] = array(
  '#type' => 'textarea',
      '#title' => 'Message',
      '#default_value' => isset($form['extra']['message']) ? $form['extra']['message'] : NULL,
  );
}

It saves it perfectly fine into the database under the field "extra" like I wanted but I'm lost as to how to use it later.

Any help is greatly appreciated, if I'm going into a completely wrong direction please say so

1

Please have a look to the new hook implemented in web form: hook_webform_select_options_info().

function mymodule_webform_select_options_info() {
  $items = array();

  $items['days'] = array(
    'title' => t('Days of the week'),
    'options callback' => 'webform_options_days',
    'file' => 'includes/webform.options.inc',
  );

  return $items;
}

The documentation for that hook describes it as follow:

Define callbacks that can be used as select list options.

Return value

An array of callbacks that can be used for select list options. This array should be keyed by the "name" of the pre-defined list. The values should be an array with the following additional keys:

  • title: The translated title for this list.
  • options callback: The name of the function that will return the list.
  • options arguments: Any additional arguments to send to the callback.
  • file: Optional. The file containing the options callback, relative to the module root.
| improve this answer | |

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.