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.
Comment | File | Size | Author |
---|---|---|---|
#4 | webform-template-default-value-2394059-4.patch | 987 bytes | m1r1k |
#4 | interdiff.txt | 982 bytes | m1r1k |
#1 | 2394059-1-webform-template-default-value.patch | 594 bytes | tstoeckler |
Comments
Comment #1
tstoecklerHere we go.
Comment #2
rv0 CreditAttribution: rv0 commentedSeems reasonable
As 4.x will be the next recommended release, changing version.
Comment #3
tstoecklerShould apply to 7.x-4.x as well. I hope this can be backported, then. That would be awesome.
Comment #4
m1r1k CreditAttribution: m1r1k at Propeople (now part of FFW) for Propeople (now part of FFW) commentedThanks for the patch!
Here is updated one with #empty_option settings usage.
Comment #5
BR0kENComment #8
rv0 CreditAttribution: rv0 commentedThanks all!