Blazor Change Validation default css class names

試著忘記壹切 提交于 2019-12-11 08:14:12

问题


I'm Trying Microsoft Blazor and when working with forms and validation I stopped on how can I change the default CSS class that will be added by default on InputText Validation State.

For Explanation when InputText has an error by default take class "invalid" I want to change this class to "is-invalid"

I Need best practises

Thanks, StackOverflow community


回答1:


Any HTML element (or InputText) attribute including the class, can be 'one-way' bound to a variable or expression. So in your case, you could do:

<input type="text" class="@((any_validation_condition)? "error_css_class" : "")" />

or just bind to a variable and set that variable at run-time to reflect the suitable display class of the element.

Thanks



来源:https://stackoverflow.com/questions/58199723/blazor-change-validation-default-css-class-names

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!