File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
src/Umbraco.Web.UI.Client
examples/validation-context
src/packages/core/validation/controllers Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -90,13 +90,13 @@ export class UmbExampleValidationContextDashboardElement extends UmbLitElement {
9090 'City server-error message' ,
9191 '8dfc2f15-fb9a-463b-bcec-2c5d3ba2d07d' ,
9292 ) ;
93- if ( this . country == '' )
94- this . validation . messages . addMessage (
95- 'server' ,
96- '$.form.tab2.country' ,
97- 'Country server-error message' ,
98- 'd98624f6-82a2-4e94-822a-776b44b01495' ,
99- ) ;
93+ }
94+
95+ #checkValidity ( ) {
96+ this . validation . validate ( ) . then (
97+ ( ) => true ,
98+ ( ) => false ,
99+ ) ;
100100 }
101101
102102 override render ( ) {
@@ -123,6 +123,8 @@ export class UmbExampleValidationContextDashboardElement extends UmbLitElement {
123123
124124 <uui- butto n look= "primary" color = "positive" @click = ${ this . #handleSave} > Save </ uui- butto n>
125125 <hr / >
126+ <uui- butto n look= "primary" color = "positive" @click = ${ this . #checkValidity} > Check valid </ uui- butto n>
127+ <hr / >
126128 <h3> Validation Context Messages </ h3>
127129 <pre> ${ JSON . stringify ( this . messages ?? [ ] , null , 3 ) } </ pre>
128130 </ uui- box>
@@ -179,7 +181,6 @@ export class UmbExampleValidationContextDashboardElement extends UmbLitElement {
179181 type= "text"
180182 .value = ${ this . country }
181183 @input = ${ ( e : InputEvent ) => ( this . country = ( e . target as HTMLInputElement ) . value ) }
182- ${ umbBindToValidation ( this , '$.form.tab2.country' , this . country ) }
183184 required> </ uui- input>
184185 </ uui- for m- validation- message>
185186 </ for m>
Original file line number Diff line number Diff line change @@ -355,7 +355,7 @@ export class UmbValidationController extends UmbControllerBase implements UmbVal
355355 this . #validators. push ( validator ) ;
356356 //validator.addEventListener('change', this.#onValidatorChange);
357357 if ( this . #validationMode) {
358- this . validate ( ) ;
358+ this . validate ( ) . catch ( ( ) => undefined ) ;
359359 }
360360 }
361361
You can’t perform that action at this time.
0 commit comments