Jack
Jack

Reputation: 387

Do not select a default value for a dropdownlist in sugarcrm

When generate a list of radio (with a dropdownlist), it will select a default value automatically.

But I do not want to select any values as default, how to set this?

enter image description here

Thanks.

Upvotes: 1

Views: 2420

Answers (5)

Josh Whitlow
Josh Whitlow

Reputation: 481

I have found a solution to this, although I would like to stress that I would not recommend this as a best practice.

I was using SuiteCRM 7.2.3, and Sugar 6.5.20. So not sure whether this will work in later Sugar Versions.

  1. Create a Radio Drop Down Field
  2. Create your drop down list
  3. Save it
  4. Go back in the dropdown editor and find your dropdown list: In my example, I had options, 0, 1, and 2.
  5. Create the same options again only as 3, 4, and 5.
  6. Now delete options 0, 1, and 2.
  7. Save the dropdown

MAKE SURE you don't save the field again after you do this, only the dropdown list.

Now go look at the field in the EditView and you'll see that no option is selected. Worked every time I did this. Nothing shows up in the DetailView, so I'm assuming NULL is being passed to the DetailView in this instance, but I'm not 100% sure.

Upvotes: 0

Jack
Jack

Reputation: 387

Thanks.

It will be radio buttons. Not a drop down list.

Upvotes: 1

Ben Hamilton
Ben Hamilton

Reputation: 46

One way we've done this by adding a value in studio of "please_select" with a display label of "-please select-" and make this the default.

This way it's obvious when staff are looking at the record that it's not filled in, and we use workflows and reports to catch the exceptions and raise the alert to the appropriate person/s.

Upvotes: 0

Robin Larsson
Robin Larsson

Reputation: 183

The only way to solve this from Studio is to add an empty row to your drop down list. If this is not preferred, then I would follow Jim's suggestion to affect all the drop downs to not contain a default value. To get the wanted affect to this single drop down then JavaScript code would be the proper tool.

Upvotes: 2

Jim
Jim

Reputation: 22656

As far as I'm aware there's no way to set this in studio.

You can set this in the database as a quick and dirty fix:

UPDATE fields_meta_data SET default_value = '' WHERE id = 'IDOFCUSTOMFIELD';

Nicer, but more involved would be to create a custom version of

modules/DynamicFields/templates/Fields/Forms/enum.tpl

which allows choosing no default value.

Upvotes: 0

Related Questions