The select component is unable to provide a unique default select option for each component.

I've made a patch to populate the default select option form that components value. See attached patch.

Other ways to do this with out hacking the module would be to use form_alter, but I'm lazy and I figured all my other installs would use this too, so I patch the module. Hopefully we could get something like this into web form as I think many users would find it useful.

CommentFileSizeAuthor
components-select.inc_.patch606 bytesj0rd

Comments

j0rd’s picture

Status: Needs review » Active

This patch will not work. It will not allow to actually default the value of the field with something like %get['foo'].

My new solution will be to allow a blank key which will fail on "field required"

Example:

*OPTIONS*
|Default Option used to Describe other option
one|Option One
two|Option Two
three|Option Three

As mentioned about if this field is required, it should not allow a submit when the value of this select is set to "Default Option used to Describe other option".

quicksketch’s picture

Status: Active » Closed (duplicate)

The original suggestion was implemented in #598742: Mandatory select listbox has 'select...' option.