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?
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)
The %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
In Drupal 8 using Webforms module you can do the following:
admin/structure/webform/manage/donation/source
Add: '#default_value': 'Yes'
To the radio button defined in the YML.
When you are adding new field in webform, select "Select option" in the type of field. After that you will get a field configuration page. In field configuration page you will see 3rd option as default value. You can put default value for that field.