This bug only occurs when #1078750: Options for "- Select -" or "- None -" not automatically added is committed to Webform (but it was intended to be committed already so presumably will be soon).
If you add a new select element within the form builder interface and then edit the options so that there is no default value, the form builder UI should show a dummy choice "-None-" as the first option (since that is how Webform behaves once the form is saved). But it doesn't do that at first; only once you've saved the form and opened it up again does it work.
This patch fixes it, but is kind of ugly. I think the fundamental problem here is that when you add a new element inside form builder, the newly-added element's #process functions don't actually run (and since the "-None-" option gets added in the #process step, it never gets added). But I'm not sure how to fix that and it seems like a much more far-reaching issue.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | form_builder-empty-value-select-1198136-1.patch | 1.94 KB | effulgentsia |
| form-builder-empty-value-select.patch | 1.94 KB | David_Rothstein |
Comments
Comment #1
effulgentsia commentedThe above patch works against 7.x-1.x, but ends up putting the 'empty_value' line on checkboxes instead of select if the patch is applied against 7.x-0.9. This is a reroll that applies correctly to both 7.x-1.x and 7.x-0.9.
Comment #2
quicksketchWow, yikes. Any way we could handle this without needing a dozen lines of documentation to explain it? And saving an actual "#empty_value" property also seems a bit unusual. Would modifying this on the Webform side make this any easier?
Comment #3
quicksketchActually upon further inspection, I can't reproduce this problem at all. If I modify the Webform form builder integration to not set a default value, the "- None -" property shows up just fine. Likewise if I edit a select field and set the default value to an empty string (which requires clicking "Manual entry" and clearing out the field), it also immediately updates with "- None -" as its first option.
If this can be reproduced on a clean install, I'd like to fix it, but right now this doesn't look as though it's a problem in a clean version of Form Builder.
Comment #4
quicksketchClosing after lack of activity.
Comment #5
jaykandariThis works as expected in latest version of form Builder 7.x-1.20.