Get Validation settings in element shape (Dynamic Forms)

Topics: Customizing Orchard
Nov 19, 2014 at 3:47 PM
I want to add Bootstrap Validator (client side validation) to my dynamic forms elements. I overrode the elements-*.chshtml files and it works very well but I need to get the validation settings in my view to set the correct settings in my validation logic.

Is there a way to get them there?
Nov 20, 2014 at 5:20 AM
Kudos for implementing your own Dynamic Forms elements!

To access your settings from your view, simply access your element's State property from your view, which is a dictionary. You could even encapsulate your validation settings with a simple class, and model bind the State dictionary against it. Have a look at the TextField element class to see how that's done.

Let me know if you have further questions about this.
Marked as answer by benschi11 on 11/20/2014 at 1:28 PM
Nov 20, 2014 at 8:28 PM
No kudos for me. I don't create my own elements, I override only the shapes of YOURS in my theme :).
And "element.ValidationSettings" did the trick :).

Marked as answer by benschi11 on 11/20/2014 at 1:28 PM