private void OnValidationStateChangedCallback(object sender, EventArgs e)
        {
            if (ValidationMessageFor != null)
            {
                var fieldIdentifier   = FieldIdentifier.Create(ValidationMessageFor);
                var validationMessage = "";
                var separator         = "";

                foreach (var message in EditContext.GetValidationMessages(fieldIdentifier))
                {
                    validationMessage += separator + message;
                    separator          = "<br />";
                }

                InvokeAsync(async() => await JsRuntime.InvokeVoidAsync("MaterialBlazor.MBTextField.setHelperText", ElementReference, HelperTextReference, HelperText.Trim(), HelperTextPersistent, PerformsValidation, !string.IsNullOrEmpty(Value), validationMessage));
            }
        }
예제 #2
0
        private void OnValidationStateChangedCallback(object sender, EventArgs e)
        {
            if (ValidationMessageFor != null)
            {
                var fieldIdentifier   = FieldIdentifier.Create(ValidationMessageFor);
                var validationMessage = string.Join("<br />", EditContext.GetValidationMessages(fieldIdentifier));

                InvokeAsync(() => InvokeJsVoidAsync("MaterialBlazor.MBTextField.setHelperText", ElementReference, HelperTextReference, HelperText.Trim(), HelperTextPersistent, PerformsValidation, !string.IsNullOrEmpty(Value), validationMessage));
            }
        }
 /// <inheritdoc/>
 private protected override async Task InstantiateMcwComponent() => await JsRuntime.InvokeVoidAsync("MaterialBlazor.MBTextField.init", ElementReference, HelperTextReference, HelperText.Trim(), HelperTextPersistent, PerformsValidation);
예제 #4
0
 /// <inheritdoc/>
 internal override Task InstantiateMcwComponent() => InvokeJsVoidAsync("MaterialBlazor.MBTextField.init", ElementReference, HelperTextReference, HelperText.Trim(), HelperTextPersistent, PerformsValidation);