Closed (works as designed)
Project:
Options Element
Version:
7.x-1.7
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 Sep 2012 at 22:20 UTC
Updated:
15 Sep 2012 at 18:12 UTC
I'm using webforms, and would like to pass a value into a webform options fields via the url.
This works find with text fields, but for the options element, there doesn't appear to be a way to set a default value for the select using tokens (%get[foo] or [current-page:query:foo] depending on if you have the token module installed).
Also, would it be possible for this to work with manual lists as well as pre-built option list?
Can we have an extra field added to the options element to allow us to set the initial state of the options list by a token?
Something along the lines of http://drupal.org/node/296453#webform-url-default
Comments
Comment #1
jmoyles commentedFor anyone stumbling across this request, here is a simplified version quick and dirty workaround I made using a hook function. This allows you to set webform values from the query string on the first load of the webform.
Comment #2
quicksketchThis is already possible if you select "Manual entry" then paste in the token. The token will be maintained in all recent versions of Options Element/Webform, per #1007532: Setting default select option with %get[]. However I think this is a good feature request to think about generally, though I'm not sure that the solution will actually be in Options Element (it might be more suitable to live in Webform or the implementing module).
Comment #3
jmoyles commentedGood to know quicksketch. Does this also work with pre-built option lists?
Comment #4
quicksketchYep, pre-built select lists may have a default value set even though the options themselves may not be changed.
Comment #5
jmoyles commentedMost Excellent! Thanks quicksketch