Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
On a Webform, without the "Select (or other)" module, one can change the default text on a required select list from "- Select" to custom text like so (see https://drupal.org/node/1331956):
function yourmodule_form_alter(&$form, &$form_state, $form_id) {
switch($form_id) {
case 'webform_client_form_your_webform_id':
$form['submitted']['component_name']['#default_value'] = '';
$form['submitted']['component_name']['#empty_value'] = '';
$form['submitted']['component_name']['#empty_option'] = '- Select country -';
break;
}
}
This code does nothing when the "Select (or other)" module "Allow 'Other...' option" is used.
Comments
Comment #1
legolasboBug fixed, thanks for reporting it! :)