Problem/Motivation

The webform_template[source] element declares a default value of 'none'. An option with that value, does not exist, however. The value (=== key) of the - none - option is 0.

Because browsers simply default to the first visible option in this case, this bug is generally hidden. When doing programmatic form submissions or when altering the form in some way (re-ordering the options, setting the fieldset to '#type' => 'hidden', etc.) this can be problematic, however.

What then happens is that the form value becomes none instead of 0, which passes the !empty() check in webform_template_submit(). Then webform_template_node_(insert|update)() ends up doing node_load('none'), which fails, and, thus, causes errors.

Proposed resolution

Change the default value to 0.

Remaining tasks

User interface changes

None.

API changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tstoeckler’s picture

Status: Active » Needs review
FileSize
594 bytes

Here we go.

rv0’s picture

Version: 7.x-1.x-dev » 7.x-4.x-dev

Seems reasonable

As 4.x will be the next recommended release, changing version.

tstoeckler’s picture

Should apply to 7.x-4.x as well. I hope this can be backported, then. That would be awesome.

m1r1k’s picture

Thanks for the patch!
Here is updated one with #empty_option settings usage.

BR0kEN’s picture

Status: Needs review » Reviewed & tested by the community

  • rv0 committed 0ffb5db on 7.x-4.x authored by m1r1k
    Issue #2394059 by m1r1k, tstoeckler: Default value of 'none' is...

  • rv0 committed 67cb4d9 on 7.x-1.x authored by m1r1k
    Issue #2394059 by m1r1k, tstoeckler: Default value of 'none' is...
rv0’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all!

Status: Fixed » Closed (fixed)

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