We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
My razorpages code is as follows:
[BindProperty] public CreateTeamViewModel CreateTeamRequest { get; set; } = default!; public async Task<IActionResult> OnPostAsync(CancellationToken cancellationToken) { var result = await this.validator.ValidateAsync(this.CreateTeamRequest!, cancellationToken); if (!result.IsValid) { result.AddToModelState(this.ModelState); return this.Page(); } var newTeam = new Team { // ..... }; this.context.Teams.Add(newTeam); await this.context.SaveChangesAsync(cancellationToken); return this.RedirectToPage("/Teams/Invite", new { teamId = newTeam.Id }); }
Chrome sees the 302:
My page never navigates:
Looks like Form Helper takes over the post, and instead makes it an AJAX call? Shouldn't it respect a 302?
The text was updated successfully, but these errors were encountered:
So I see I should have used:
return FormResult.CreateSuccessResult( "Product saved. Please wait...", this.Url.Page("/Teams/Invite", new { teamId = newTeam.Id }));
that works. But the README says:
You can also use the form validator without ajax.
How do I do that?
Sorry, something went wrong.
Okay after digging through samples, I found that I need [FormValidator] attribute. Turns out that it doesn't work for RazorPages:
[FormValidator]
What do I do now?
No branches or pull requests
My razorpages code is as follows:
Chrome sees the 302:
My page never navigates:
Looks like Form Helper takes over the post, and instead makes it an AJAX call? Shouldn't it respect a 302?
The text was updated successfully, but these errors were encountered: