Closed (fixed)
Project:
Webform References
Version:
7.x-1.8
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 May 2015 at 06:29 UTC
Updated:
29 Mar 2016 at 02:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
guignonvTry this patch, it should not add "No value" when component is required.
Note: when not required, the "No value" item is added at the end of the list. Maybe that list should be alphabetically sorted and "No value" added at the top?
Comment #3
cmedina commentedIn my opinion, it would be better to indicate the property "#empty_option" and property "#empty_value" in the "select" element. I think "No value" should never be added (it is independent of whether the field is defined as mandatory or not).
Comment #5
sumitmadan commentedThanks cmedina,
I have committed the code with `#empty_option' to dev branch . :)
Comment #7
yaach commentedI dont see the feature @cmedina proposed. I have downloaded current and dev versions. I still have the "No Value" option.
In my case I have a Node Reference field which is not required. I would prefer a "Select Option" for empty option rather than "No value".
Anyway, could you describe how to get the 'EMPTY OPTION'
Thanks.
Comment #8
yaach commentedComment #9
sumitmadan commentedHi @yalegria,
I have added
'#empty_option' => t('No Value'),to form element instead of adding "no value" to options array. So if you want to replace "No Value" then please use String Override module or use hook_form_alter way.Comment #10
yaach commentedHi @sumitmadan,
I actually wanted the same "Empty option" implemented on the webform select list component, where if the field is required then "Select" would be the default option; and if the field is NOT required the default option would be "None".
I have ported this to webform_references and created a patch.
Comment #11
yaach commentedComment #13
Chewits commentedBy the way, why not to rename "No Value" to "- None -"?
When I use a field of type "Term reference" for User entity with widget "Select list", the list of terms is rendered with "- None -" item.
When I try to use the same vocabulary in a Webform it shows "No Value".. Let's use the same word "- None -".
To be more exacts:
"Term reference" field is rendered as:
The same item on Webform:
Comment #14
joel_osc commentedUpdating the version reference in the case, setting as a defect to make consistent with other Drupal selects and setting back to needs review for the bots - patch looks good, nice work on it!
Comment #15
sumitmadan commentedThank you all for you efforts. I have committed and pushed the changes.