Closed (fixed)
Project:
Webform
Version:
7.x-4.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Dec 2014 at 12:15 UTC
Updated:
29 Mar 2015 at 21:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
markus_petrux commentedComment #2
danchadwick commentedThis doesn't sound right to me. Every element should have a #default_value. I think we need to fix this at the source, which is probably not within webform itself.
Comment #3
markus_petrux commentedI think the problem is Select or Other module defines this as NULL in select_or_other_element_info(), which is left like that if the user does not set a default explicitly.
The PHP notice happens when trying to edit the Webform properties with Form Builder.
Any idea on which is the best place to address this issue?
PS: Thanks for the quick reply!
Comment #4
danchadwick commentedMoving this to the Form Builder queue. Please feel free to move back here if indeed there is an issue in webform itself.
Comment #5
markus_petrux commentedhmm... I think it is possible that #default_value is not defined at all. For example, for radios elements where the webform editor needs to force the end user to choose an option.
So in this scenario, it makes sense to check if it is set before seeing if it's an array.
Comment #6
torotil commented_webform_render_select()doesn't guarantee that #default_value is set (value==NULL and multiple=FALSE) andwebform_expand_select_or_other()does rely on it being set. That's clearly a bug in webform.BTW the default_value-logic in _webform_render_select() is so unreadable that it warrants a refactoring anyway.
Comment #8
danchadwick commented@torotil -- Something is still wrong with Form Builder. The #default_value is filled in when form_builder() (the form.inc core function, not the contrib module) calls element_info(). select_or_other_element_info() sets the #default_value to NULL for select_or_other elements.
That said, I think it is better if the default is always set. The code was hideously redundant, so I simplified it. I have tested every case I can think of and
hopeam pretty sure that I haven't created any regressions.Committed to 7.x-4.x and 8.x.
Comment #9
torotil commentedThanks for taking the time to simplify the code. I might include that in 7.x-3.x too. Fixing this in form_builder would have been a lot harder.
Comment #10
torotil commentedHere is the backport to 7.x-3.x.
Comment #12
danchadwick commented