Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
1. Install and enable Webform and Options Element.
2. Create a Webform adding a 'Select options' component.
3. Choose a pre-built options list.
4. Save the component.
5. Edit the component.
The various settings for the options are disabled. They should be enabled. If Options Element is disabled, there is no problem. The problem exists whether or not JavaScript is enabled, so the problem is not there.
This is probably related in some way to #1493894: Notice: Undefined index: options_text in _form_options_validate() (Default values in Options Elements not editable).
Comment | File | Size | Author |
---|---|---|---|
#6 | webform_1513894_pre-built-options.patch | 529 bytes | Liam Morland |
#4 | webform_1513894_pre-built-options.patch | 488 bytes | Liam Morland |
Comments
Comment #1
quicksketchThe settings for options are supposed to be disabled if you're using a pre-built list, since that list is being provided by code. If you want to edit the list, you can pre-fill the list by selecting a pre-built list, then changing it back to "None". Then you can edit the options but they'll no longer be provided through code.
Comment #2
Liam MorlandI can't change it back to None; that setting is disabled. So is "customize keys" and the other settings in the Options fieldset.
Comment #3
quicksketchOh, yep you're quite correct. I think this is Webform having this effect. Everything works fine while you're editing the component like it's intended (you can see the list and set a default, but not change the values or order), but after saving and re-editing the component things go all wrong.
Comment #4
Liam MorlandThanks. The attached patch solves the issue. Everything seems to work properly. I like simple solutions!
Comment #5
Liam MorlandComment #6
Liam MorlandOne problem: The first solution allows the values to be edited when a pre-built list is selected, though the edits are not saved. The attached patch, which patches Options Element instead, produces the desired behavior, but I am not clear if it has unintended side-effects. Please review.
Comment #7
Liam MorlandComment #8
quicksketchThanks Liam, does your latest patch in #6 replace the one in #4, or do they both need to be applied?
Comment #9
Liam MorlandJust #6 is needed.
Comment #10
quicksketchThanks committed to both branches.
Comment #11
Liam MorlandThanks. I'm not seeing the change when I do a git pull. Have you pushed it yet?
Comment #12
quicksketchSorry I hadn't pushed. Up now.