Take away non-use validators in Episerver forms?

Vote:
 

Hello,

I'm using episerver forms 4.4.1. I would like to take away non-use validators in Text form element or make the validators unique for each type of using purpose.

For example: If that textbox using to fill a name, then it's enough to use only required as validator. But if that textbox using as fill birthday, then of course needto keep datetime as validator.

Anyone has ide how to make validators unique for each kind of textbox?

Regards,

#183147
Oct 05, 2017 18:26
Vote:
 

Hi, validators are enable for Element Type.

So you need V1 V2 for NameTextBox, V3 V4 for BirthTextBox, you should extend the built-in TextBox to 2 more types, then change the available for each type by declare your attribute AvailableValidatorTypes

Document is here https://world.episerver.com/documentation/developer-guides/forms/creating-form-element-with-validator/

#183176
Edited, Oct 06, 2017 10:11
Vote:
 

See this one, it only have one Validator: Required

#183177
Oct 06, 2017 10:12
Vote:
 

You can make it an add-on as well, I've done a similar thingie for EmailElementBlock - almost the same as TextBoxElementBlock, but then I didn't need the "Email validator".

You can find some inspiration here. It's available on nuget as well.

#183180
Oct 06, 2017 10:42
* 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.