I have created a website for yacht charter http://cozmoyachts.com

I have created one booking form for yacht booking using webform module and used that form on all yachts pages. Like 45 feet yacht, 55 feet yacht and so on...

In that form there is a select list to select a yacht.

I want to change the default value of that select list according to the URL of page.

So if the visitor is on 33 feet yacht page the default value in select of booking form should be 33 Feet Yacht.

Hope I am able explain my question properly.

1 Answer 1


If you fx want to set the default value using, given it is passed as a parameter in the URL:

function hook_form_FORM_ID_alter(&$form, &$form_state) {
  $params = drupal_get_query_parameters();
  if (isset($params['my_param'])) {
    $form['FIELD_NAME']['und'][0]['#default_value'] = $params['my_param'];


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.