0

enter image description hereI am using webform and with all the tons of modules available so far there was virtually nothing I had to compromise on.

One thing I am stuck with is re-using user text input. Is this possible without writing a custom webform module on a multi-page form:

  1. user initially enters some text in 4 textfields
  2. populate form checkboxes with those values?

There is the token module installed but I can't figure out a way to populate the checkboxes dynamically (coming from the user and not from a premade select list). The webform_ajax module tells me I can't use it on multi-page forms.

Any suggestions how to achieve something like this where the user enters something and this shows up later in the form?

UPDATE:

I am trying to use hook_webform_select_options_info. How can I target the specific webform, text and select field? Devel does not show any webform ID. The screenshot shows textfield and selectlist information

From the link

function hook_webform_select_options_info() {
  $items = array();
  $items['customusergroups'] = array(
 'title' => t('Your user groups'), 
 'options callback' => 'webform_options_days', 
 // 'file' => 'includes/webform.options.inc',
 );
 return $items;
}
1
  • You can give them the value with the form_state. Check the hook_form_alter.
    – GwenM
    Feb 12, 2016 at 15:35

1 Answer 1

0

There is a hook in webform called hook_webform_select_options_info, that allows you to build a dynamic list of $items[] (return $items), which will be used as the list of options for your component. What you put into this list can obviously be anything - i.e. how you decide what to put in is up to you.

I used it recently to create a multi-route dynamic web form where the path through the webforms is determined by a decision tree. Ever option on every question is loaded from a JSON file, and depending on the answer, the next question (which could be any one) is shown.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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