Try our conversational search powered by Generative AI!

Which validator do I used to exclude SelectionElementBlock multiselect?

Vote:
 

I only want to allow the required validator for a custom and remove multiselect as an Editor option for an element based on SelectionElementBlock.

[AvailableValidatorTypesAttribute(Include = new Type[] { typeof(RequiredValidator)},     Exclude = new Type[] { typeof(???)})]
#200218
Jan 04, 2019 23:16
Vote:
 

I guess that you only want RequiredValidator for your custom element, and the validator should be removed for MultiSelect. If my understanding is true, so you probably can do it by customizing IValidationService.GetValidatorTypesForAnElementTypeInEditView that basically returns validators for a specific element. 

#200229
Jan 07, 2019 3:50
Vote:
 

Yes, I want to remove "Allow multiple choices" from Edit mode.

I've tried to look at the validators in the element's default constructor but it's always null.

this.AllowMultiSelect = false;

            if (this.FormElement != null && this.FormElement.Validators != null && this.FormElement.Validators.Any())
            {
                foreach (var validator in this.FormElement.Validators)
                {

                }
            }

#200299
Jan 08, 2019 16:56
Vote:
 

Hi Eric,

Allow multiple choices is a property of SelectionElementBlock, not a validator.

To hide that property from EditView. Go to Admin -> Content Type -> [Basic Element] Selection => Edit Property AllowMultiSelect as below

#201286
Edited, Feb 12, 2019 9:48
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.