Hi

My site is here http://www.fdea.co.uk/sitemaster-epc-order-form.html.

I would like to be able to change the 'select...' text for the drop downs in the Requests fieldset to '0', but cannot see how to do this.

Does anyone know!?

Thanks

Matt

Comments

watcha’s picture

When you edit a webform field, you can specify a default value. it is the third textbox.

mattys’s picture

thanks watcha

i had done this already, for the 'Book on demonstration day' drop down, is still set to display 0, but still displays select...

I have also set default value for Order Sitemaster EPC drop down to 0, but also still displays select...

I have flushed caches, but no difference.

Maybe I'm missing something...!?

Matt

watcha’s picture

Set the component to mandatory, and it will display the default option, instead of "select..."

mattys’s picture

i set to mandatory, but it still didn't display 0

also, i don't want t set to mandatory as the info isn't mandatory

any other ideas?

watcha’s picture

tested on drupal 6.19 webform-6.x-3.2

Enable module
create form
add select list component
changed default value to "0"
saved
cleared cache.

These steps display a "0" instead of "settings..."

mattys’s picture

yep, done all this, 6.19, double, triple, quadrauple checked, no joy...

watcha’s picture

Sorry, cant reproduce your error.

last resort is to edit webform/components/select.inc

comment out lines 274-6

if ($component['extra']['aslist'] && !$component['extra']['multiple'] && !($component['mandatory'] && $default_value !== '')) {
  $options = array('' => t('select...')) + $options;
}

Hacking the Core module is a terrible idea because you may introduce new errors, and your changes will disappear when you update the module

mattys’s picture

yep, don't want to do that, especially because i only want this for this form

thanks for help watcha, appreciated

el_guiye’s picture

puedes identificar el id del form y con ello modificar la linea segun el form que se va a mostrar.

if($component['nid']==137){
$options = array('' => ($component['mandatory'] ? t('- tut texto -') : t('- None -'))) + $options;

}else{
$options = array('' => ($component['mandatory'] ? t('- Select -') : t('- None -'))) + $options;
}

Saludos

Anonymous’s picture

I can make things work here by using key-value pairs for Option values, and referencing the chosen Option value in the Default field. So:

Default value:
0_User

Options:
0_User|0 User
1_User|1 User
2_Users|2 Users
3_Users|3 Users
...

Cache must be flushed. Keys can't have spaces.

This works, too - perhaps simplest, but only number is stored in DB/passed to recipient:

Default value:
0

Options:
0|0 User
1|1 User
2|2 Users
3|3 Users
...

Hope this works for you...
Ed

nnevill’s picture

in hook_form_alter:

$form['submitted']['field_name']['#options'][''] = t('bu');

twooten’s picture

thanks for the code, works great!

I have a couple select fields for credit card and the following works.

$form['submitted']['payment_information']['CCExpireMonth']['#options'][''] = t('Month');
$form['submitted']['payment_information']['CCExpireYear']['#options'][''] = t('Year');