1

I have a couple CiviCRM Options fields on a Drupal 9 Webform. I want to make it so there is no default value. There is an option to choose the default but I have not selected one.

enter image description here

The Prefix field shows Mrs. as a default. I added a membership type for the membership field that has the same problem but this is messy. That option will not work with the prefix because we do not want to have a prefix to ignore when doing mailings.

Any ideas of how to get around this is greatly appreciated.

Thanks,

Steve

1 Answer 1

1

Yes there is a bug here with it not having a 'no default' option. from memory you can do something like this. switch to static, untick the option that is beahving as 'default', save, then re-edit, set back to dynamic and resave. does that work for you?

Other things that may work depending on the component type

Open 'source' and in the YAML find in the relevant component

    '#default_option': '0'
    '#default_value': '0'

and delete them.

If it is a listbox then it will just show the first in the list UNLESS you type something into the ‘Empty option label’ field in the component/element. eg type -SELECT-

7
  • unfortunately I tried this and it is not working. There is no default value selected when set to either static or dynamic. If you have any more ideas of how to get this to work I would appreciate it. Thanks!
    – Josh
    Commented Jun 30, 2021 at 7:00
  • so you tried disabling Mrs. and then resaving, and then setting back to Dynamic and resaving again?
    – petednz - fuzion
    Commented Jun 30, 2021 at 20:49
  • yet I did. I just tried it again right now too.
    – Josh
    Commented Jul 6, 2021 at 1:55
  • A listbox will just show the first in the list UNLESS you type something into the ‘Empty option label’ field in the component/element. eg type -SELECT-
    – petednz - fuzion
    Commented Jul 21, 2021 at 4:14
  • I have just come across a similar and infuriating issue - I have two Yes/No radios. One I can set to no default value and it works fine i.e. default_option: '' and the other one, despite having exaclty the same, defaults to 'No'... I've tried everything to change this but it keeps being reset to No...
    – ChumKui
    Commented May 5, 2022 at 16:47

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.