Hattabitos | Posts: 24

Drop List field

0 votes
When I'm adding a drop list field, I'm getting error: error.validation.field.ListWithInvalidDefaultValue Here is the code
fieldBuilder = FieldBuilder.DropList();
                            foreach (OptionValue optionValue in formField.OptionValues)
                            {
                                validator.WithOption(optionValue.Value);
                            }

harishaidary | Posts: 1812

Reply to: Drop List field

0 votes
Hey Ahmad, It seems like the default value should be one of the options you define in your foreach loop. It doesn't look like you can set an empty or different default value with the SDK. Try setting
fieldBuilder.Value = optionValue.Value;
. This will set the default value of your DropList to one of your options. Let me know if it works for you.

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off