Exemple #1
0
        private async Task HandleSubmitAsync()
        {
            Debug.Assert(_fixedEditContext != null);

            if (OnSubmit.HasDelegate)
            {
                // When using OnSubmit, the developer takes control of the validation lifecycle
                await OnSubmit.InvokeAsync(_fixedEditContext);
            }
            else
            {
                // Otherwise, the system implicitly runs validation on form submission
                var isValid = _fixedEditContext.Validate(); // This will likely become ValidateAsync later

                if (isValid && OnValidSubmit.HasDelegate)
                {
                    await OnValidSubmit.InvokeAsync(_fixedEditContext);
                }

                if (!isValid && OnInvalidSubmit.HasDelegate)
                {
                    await OnInvalidSubmit.InvokeAsync(_fixedEditContext);
                }
            }
        }
Exemple #2
0
        private async Task HandleSubmitAsync()
        {
            if (OnSubmit.HasDelegate)
            {
                await OnSubmit.InvokeAsync(_fixedEditContext);
            }
            else
            {
                var isValid = _fixedEditContext.Validate();

                if (isValid)
                {
                    if (OnValidSubmit.HasDelegate)
                    {
                        await OnValidSubmit.InvokeAsync(_fixedEditContext);
                    }
                    else
                    {
                        await HandleValidSubmit();
                    }
                }

                if (!isValid && OnInvalidSubmit.HasDelegate)
                {
                    await OnInvalidSubmit.InvokeAsync(_fixedEditContext);
                }
            }
        }
Exemple #3
0
        public async void OnFinishClicked()
        {
            if (FreezeCurrentStep)
            {
                return;
            }

            await OnSubmit.InvokeAsync(new SubmitEventArgs());

            StateHasChanged();
        }
        private async Task SetNextAnswer()
        {
            CurrentAnswer = Answers.FirstOrDefault(x => !x.IsAnswered);
            await Storage.SetAsync($"{PlayerId}-Answers", Answers);

            if (CurrentAnswer is null)
            {
                await OnSubmit.InvokeAsync(Answers);

                await Storage.DeleteAsync($"{PlayerId}-Answers");
            }
        }
        protected async Task HandleSubmit(EventArgs args)
        {
            Form.Validate();

            if (Form.Valid)
            {
                await OnSubmit.InvokeAsync(Form.Values);
            }
            else
            {
                await OnError.InvokeAsync(Form.Error);
            }
        }
        protected async void HandleValidSubmitModal()
        {
            ApiResultModel <Warehouse_Area> response = await _api.Post($"inventory/Warehouse/CheckArea", ModelData);

            if (response.Status == 200)
            {
                await OnSubmit.InvokeAsync(ModelData);
            }
            else
            {
                if (formValidator != null && response.Errors != null && response.Errors.Count > 0)
                {
                    formValidator.DisplayErrors(response.Errors);
                }
                _toastService.ShowWarning(response.Message, "Failed");
            }
        }
Exemple #7
0
 private void HandleSearch()
 {
     OnSubmit.InvokeAsync();
 }
 public Task Submit()
 {
     return(OnSubmit.InvokeAsync(Answers));
 }