File tree Expand file tree Collapse file tree 4 files changed +13
-2
lines changed
src/BootstrapBlazor.Server Expand file tree Collapse file tree 4 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 7474</DemoBlock >
7575
7676<DemoBlock Title =" @Localizer[" Block4Title " ]" Introduction =" @Localizer[" Block4Intro " ]" Name =" ValidateForm" >
77- <ValidateForm Model =" @Model" >
77+ <ValidateForm Model =" @Model" @ref = " ValidateForm1 " >
7878 <div class =" row g-3 form-inline" >
7979 <div class =" col-12 col-sm-6" >
80- <Cascader Items =" @_items" @bind-Value =" @Model.Address" />
80+ <Cascader Items =" @_items" @bind-Value =" @Model.Address" IsClearable = " true " />
8181 </div >
8282 <div class =" col-12 col-sm-6" >
8383 <Button ButtonType =" ButtonType.Submit" >@Localizer ["SubmitButtonText"]</Button >
84+ <Button OnClick =" OnValidate" class =" ms-3" >@Localizer ["ValidateButtonText"]</Button >
8485 </div >
8586 </div >
8687 </ValidateForm >
Original file line number Diff line number Diff line change @@ -30,6 +30,9 @@ public sealed partial class Cascaders
3030 [ NotNull ]
3131 private ConsoleLogger ? NormalLogger { get ; set ; }
3232
33+ [ NotNull ]
34+ private ValidateForm ? ValidateForm1 { get ; set ; }
35+
3336 private List < CascaderItem > _items = [ ] ;
3437
3538 /// <summary>
@@ -85,6 +88,11 @@ private EventItem[] GetEvents() =>
8588 }
8689 ] ;
8790
91+ private void OnValidate ( )
92+ {
93+ ValidateForm1 . Validate ( ) ;
94+ }
95+
8896 /// <summary>
8997 /// 获得属性方法
9098 /// </summary>
Original file line number Diff line number Diff line change 23062306 "Att7": "The data collection",
23072307 "Event1": "This event is triggered when the cascading selection option changes",
23082308 "SubmitButtonText": "Submit",
2309+ "ValidateButtonText": "Validate",
23092310 "item1": "Melbourne",
23102311 "item1_child1": "Brunswick",
23112312 "item1_child1_child": "so-and-so street",
Original file line number Diff line number Diff line change 23062306 "Att7" : " 数据集合" ,
23072307 "Event1" : " 级联选择选项改变时触发此事件" ,
23082308 "SubmitButtonText" : " 提交" ,
2309+ "ValidateButtonText" : " 验证" ,
23092310 "item1" : " 北京" ,
23102311 "item1_child1" : " Brunswick" ,
23112312 "item1_child1_child" : " so-and-so street" ,
You can’t perform that action at this time.
0 commit comments