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
Include @Html.HiddenForCurrentPagePath() to your form
@Html.HiddenForCurrentPagePath()
<form method="post"> @Html.HiddenForCurrentPagePath() ... </form>
Use RenderRefererPageAttribute on your action
RenderRefererPageAttribute
[HttpPost, RenderRefererPage] public IActionResult Submit(MessageEntity entity) { if (ModelState.IsValid) { .... } return View(entity); }
Get model from widget service WidgetDisplayContext.Model:
WidgetDisplayContext.Model
public override WidgetViewModelPart Display(WidgetDisplayContext widgetDisplayContext) { if (widgetDisplayContext.Model is MessageEntity messageEntity) { return widgetDisplayContext.ToWidgetViewModelPart(messageEntity); } return widgetDisplayContext.ToWidgetViewModelPart(new MessageEntity()); }
The text was updated successfully, but these errors were encountered:
组件提交表单,服务端验证失败时还原页面并显示ModelState的错误信息 #406
bc71eb4
提交Form失败时,用户填写的数据 #406
0acae03
No branches or pull requests
How to use
Include
@Html.HiddenForCurrentPagePath()
to your formUse
RenderRefererPageAttribute
on your actionGet model from widget service
WidgetDisplayContext.Model
:The text was updated successfully, but these errors were encountered: