I have a standard contact page created using webform, which has a set of radio buttons.
Is it possible to change the pre-selected radio option based on the referring page?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
I would add ?selectValue=yourvalue to the links pointing to your webform.
Then, create a template node--webform.tpl.php, check if i'm in the correct webform with the $node object and if $_GET['selectValue'] is set. Then use jQuery to select my radio button.
It might not by the perfect solution, but it's clearly a way out!
With Webform you can pre-populate form default values via the url with tokens:
Setting Default Values from the URL (7.x-3 and earlier)
%get[key] supported by Webform allows form values to be populated from the URL.
Setting Default Values from the URL (7.x-4)
To set the default values of a component to use either:
Query Format: For urls formatted like http://example.com/node/120?key=bar use
[current-page:query:key] to return key value.,
Args Format: For urls formatted like http://example.com/node/120/key use
[current-page:url:args:2] to return key.
Taken verbatim from webform docs