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.

Comments

effulgentsia’s picture

The 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.

quicksketch’s picture

Wow, 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?

quicksketch’s picture

Status: Needs review » Postponed (maintainer needs more info)

Actually 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.

quicksketch’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Closing after lack of activity.

jaykandari’s picture

Issue summary: View changes

This works as expected in latest version of form Builder 7.x-1.20.