Enabling Form Builder removed the ability to enable functionality provided by the Select (or other) module. The option for other exists on the relevant fields prior to enabling Form Builder, but the options disappear once it is enabled. Form Builder seems to be missing integration with Select (or other).

For others looking for a quick fix: disable Form Builder module, enable the other option on your desired select boxes / radio buttons / check boxes, re-enable Form Builder.

Comments

jlyon’s picture

Here's a patch that adds rudimentary integration. The select or oher options should appear on the Other Options fieldset in the Options tab, but I had all sorts of problems when In tried to put it there. There are a lot of calls happening between form_builder_webform forms, options_element, select_or_other and webform, and I got a little confused.

jlyon’s picture

Status: Active » Needs review
jlyon’s picture

TODO: I just created a patch to hide the 'Other options' textfield unless the checkbox is checked, but for some reason it does not work with this patch: #1667662: Hide Text for "Other..." textfield by default for Select components. Perhaps form_builder is ignoring the #states array?

synesthete’s picture

The patch in #1 works great on the first time setting up the Webform components with Form Builder. If I come back to the Webform tab after saving, the Select items that have the Other... option enabled do not show up. Subsequent saving the form completely knocks out and select items with the Other... option enabled.

jlyon’s picture

@synesthete: I have observed the same behavior. I'll look at a fix in the next couple days.

hyperglide’s picture

@jlyon any updates?

thank you.

estoyausente’s picture

I'm working in this issue, I need it for a project.

The patch starts very good but the new element created don't be processed. You can complete the webform but when you try to edit, the element has not been process (you can see it if inspect the class of the element).

I try resolve and if i do it, share the solution. ;)

jlyon’s picture

Great, thanks! Post back with whatever you learn. I have tried looking into it on a few occasions with no success.

estoyausente’s picture

StatusFileSize
new6.74 KB

Grr... Almost i finish the module. Now, the patch run perfectly but they throw 2 notices for 2 vars:

Notice: Undefined index: #size en select_or_other_element_process() (línea 102 de /sites/all/modules/contrib/select_or_other/select_or_other.module).
Notice: Undefined index: #disabled en select_or_other_element_process() (línea 182 de /sites/all/modules/contrib/select_or_other/select_or_other.module).

I'm sure that this solution isn't perfect, but I need a hand with this. I try do it, if any want help me, will be great. I try finish the patch, if i can, i post the solution.

regards. :)

jojo76’s picture

Sorry but patch at #9 didn't work for me. When applying, I get the error;

Hunk #3 FAILED at 763.

The other 5 hunks succeeded.

If it helps, the contents of the reject file are;

*** modules/webform/form_builder_webform.components.inc	2012-11-29 11:48:57.000000000 +0100
--- modules/webform/form_builder_webform.components.inc	2012-11-29 13:57:10.000000000 +0100
***************
*** 763,768 ****
  function _form_builder_webform_form_builder_load_select($form_element) {
    // Properties that are only used by Form Builder and not in the normal form.
    $form_element['#key_type_toggled'] = !empty($form_element['#webform_component']['extra']['custom_keys']);
    return $form_element;
  }
  
--- 766,772 ----
  function _form_builder_webform_form_builder_load_select($form_element) {
    // Properties that are only used by Form Builder and not in the normal form.
    $form_element['#key_type_toggled'] = !empty($form_element['#webform_component']['extra']['custom_keys']);
+   $form_element['#other_option'] = !empty($form_element['#webform_component']['extra']['other_option']);
    return $form_element;
  }
  

I applied the patch via patch -p1 < form_builder_2.diff Is this correct?

The Form_Builder module continues to function but access to the built-in lists such as Country still not integrated.

Hope you can help. Many thanks for this so far.

estoyausente’s picture

StatusFileSize
new6.74 KB

You apply the patch correctly, it is posible that the file isn't good.

I made the file again, and attach to this message. Send me feedback, plz.

jojo76’s picture

Many thanks SamuelSolis for your response. Unfortunately I get the exact same error again on the patch but in 'fiddling' some more I came up with the following recipe which seems to work for me.

1. The test installation is a clean install of D7.17. The only contributed modules installed and enabled are Webform, Form builder, Form builder Webform UI, Options element and Token.

2. Create the form as normal - Add content / webform

3. Add required fields to the form using the Form builder UI. Add a Select List field (I want mine to be Country name). At this point the Options to use built-in lists (Country, US States etc) does NOT appear. Just continue to add field descriptions as you would wish them to be.

4. Now Disable the Form builder Webform UI module. No need to disable anything else.

5. Go back to the form, edit the 'Country' field - the Options for built-in lists appear as normal. Change the field to be Country (or whatever) and save.

6. Enable the Form builder Webform UI module.

7. Go back to the form, the built-in Options still NO NOT appear and the List field is NOT the Country list you changed it to in step-5.

8. Make an edit to any of the fields in the form and when you exit from that edit, the Select List field immediately changes to the Country list (or whatever you choose).

9. Subsequent edits to the form retain the Select List field in the desired form.

Many thanks again for the patch.

estoyausente’s picture

Thank for the feedback. I try work again about it, and I try to do the patch with Git (never do it, but I need a first time! :-) ). If any other work in this patch, please, share the solution.

Regards.

estoyausente’s picture

Status: Needs review » Active
estoyausente’s picture

StatusFileSize
new11.4 KB
new30.49 KB

I could apply the patch with the next code:
patch -p0 < form_builder.diff

I know isn't very good solution, but if any can help me, apply the patch and make other with git, i don't know exactly the way of do this.

The patch run correctly, only have Notices:

Notice: Undefined index: #disabled en select_or_other_element_process() (línea 99 de /Applications/XAMPP/xamppfiles/htdocs/observatorio/sites/all/modules/contrib/select_or_other/select_or_other.module).
Notice: Undefined index: #size en select_or_other_element_process() (línea 102 de /Applications/XAMPP/xamppfiles/htdocs/observatorio/sites/all/modules/contrib/select_or_other/select_or_other.module).
Notice: Undefined index: #disabled en select_or_other_element_process() (línea 182 de /Applications/XAMPP/xamppfiles/htdocs/observatorio/sites/all/modules/contrib/select_or_other/select_or_other.module).

Share two captures of this:
Capture of form
capture of result

Thank for the help.

torotil’s picture

Status: Active » Needs review
StatusFileSize
new4.1 KB

Here is an updated patch, that works quite well for us.

estoyausente’s picture

Yeah, thank you. I'm going to test it.

barraponto’s picture

Status: Needs review » Needs work

It seems to work, but... it doesn't update the preview properly.

Also, I see a lot of undefined indexes:

Notice: Undefined index: #disabled em select_or_other_element_process() (linha 98 de /home/barraponto/Playground/aeconsulta/builds/20130415-212423/profiles/aeconsulta/modules/contrib/select_or_other/select_or_other.module).
Notice: Undefined index: #size em select_or_other_element_process() (linha 101 de /home/barraponto/Playground/aeconsulta/builds/20130415-212423/profiles/aeconsulta/modules/contrib/select_or_other/select_or_other.module).
Notice: Undefined index: #disabled em select_or_other_element_process() (linha 181 de /home/barraponto/Playground/aeconsulta/builds/20130415-212423/profiles/aeconsulta/modules/contrib/select_or_other/select_or_other.module).
barraponto’s picture

Rerolled the patch. I just tweaked _form_builder_select_or_other_form_element_pre_render to improve its readability.

barraponto’s picture

Issue summary: View changes

Fixing grammar.

heyyo’s picture

I just apply the patch from #19 on forum_builder 7.x-1.4, it works correctly, but I don't see the possibility to change the text "Other" ?

softone’s picture

Issue summary: View changes
Status: Needs work » Needs review
amerie’s picture

Status: Needs review » Reviewed & tested by the community

I also applied patch #19 using the patch command (patch -p1 < patchfile.patch). It does restore Select (or Other) functionality, but the select list preview in form builder does not show the "Other..." option (it does show in the actual live form, and the preview works for radio buttons).

markus_petrux’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new4.86 KB

Hi all. I'm attaching a patch that adds support to change the "Other..." text, which is a feature of Select Or Other module already integrated in Webform.

It's basically the same as #19 (with fixes for a few coding standard issues) + the mentioned option to alter the "Other..." text.

Cheers

markus_petrux’s picture

torotil’s picture

Status: Needs review » Needs work

Hi,

just looking at the code there are a few things that stop me from committing this right away:

  1. +++ b/includes/form_builder.admin.inc
    @@ -387,7 +387,9 @@ function theme_form_builder_wrapper($variables) {
    +  if (!empty($element['#select_type']) && empty($element['#type'])) {
    +    $element['#type'] = $element['#select_type'];
    +  }
    

    IMHO shuffling around the element['#type'] shouldn't be done in a theme-function. Why is this needed anyway?

  2. +++ b/modules/webform/form_builder_webform.module
    @@ -325,6 +327,27 @@ function form_builder_webform_load_process(&$form, $node, $pid = 0) {
    +        'element_id' => 'cid_' . $form[$key]['#webform_component']['cid'],
    

    Does this also work for newly added fields?

EDIT: never mind the 2nd comment.

markus_petrux’s picture

Not sure on 1). It was present in previous patches.

torotil’s picture

I've removed the changes to the theme function (they were only needed due to #2240995: Unset $element['#type'] in select_or_other_element_process() causes other modules to throw errors) and fixed up the pre_render function (needed to set the $form['#form_builder']['element_type']).

  • torotil committed 2a2ce3d on 7.x-1.x
    Issue #1575064 by estoyausente, torotil, jlyon, markus_petrux,...
torotil’s picture

Component: Form Builder Core » Webform Itegration
Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.