Postponed
Project:
Elements
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Jun 2008 at 13:09 UTC
Updated:
16 Feb 2011 at 10:01 UTC
Jump to comment: Most recent file
Comments
Comment #1
heine commentedAn excellent, feature rich addition to the elements module.
I've only one issue with the current element. Submitting the form below with the 'Second Option' selected will get me 'Second Option' as form value in the submit handler.
Should it not return the _key_ of the option, similar to the way #type select behaves or, when 'Other' has been selected, the value of the texfield?
The same holds for the behaviour of #default_value; shouldn't it accept keys (but then again, what to do when key is the value of the other option?)?
To use the element in its current inception, you'd have to pass the #default_options array as #type value to the submit handler so it can reconstruct the key selected . One also has to choose the right translated value for #default_value in the builder.
Comment #2
john morahan commentedThe trouble is that it's a combination of two elements, one of which naturally returns a key, the other naturally returns a value.
How about something like this? The value is now e.g. array('option' => 'two', 'value' => 'Second option') and the #default_value would be array('option' => 'two') for the select, or array('value' => t('Third option')) for the textfield.
This gives the developer a way to tell the difference between a selected option and a typed value that's identical to an existing key or value.
(I haven't had time to test this version extensively yet)
Comment #3
john morahan commentedUhh, there was supposed to be a patch attached to that, but I guess it didn't upload and now I'm in the office and the patch is at home... I'll upload it this evening.
Comment #4
john morahan commentedSeems there have been some upload problems all round, today. Let's try this one again.
Comment #5
dave reidYou want this module: http://drupal.org/project/select_or_other
Comment #6
dave reidActually I've posted in #981530: Port Select (or other) module to D7 to see if the module would like to merge into Elements since I think it would make a lot of sense.
Comment #7
quicksketchThis would be great if Elements and Select or Other merged, then Webform could use all of the fields provided by elements, right now we're only supporting Select or Other, since it's the most important one for us.
Comment #8
danielb commentedDave, please check back in the Select (or other) issue
Comment #9
joostvdl commentedSubscribe