Merge pull request #3857 from sbwalker/dev
fix ModuleMessage - form name must be a constant value in static rendering or else it will not post correctly
This commit is contained in:
commit
edcb24068a
|
@ -1,5 +1,4 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@using System.Globalization
|
||||
@inherits ModuleControlBase
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
|
@ -7,20 +6,24 @@
|
|||
{
|
||||
<div class="@_classname alert-dismissible fade show mb-3" role="alert">
|
||||
@((MarkupString)_message)
|
||||
@if (Type == MessageType.Error && PageState != null && UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
|
||||
@if (PageState != null)
|
||||
{
|
||||
@((MarkupString)" ")<NavLink href="@NavigateUrl("admin/log")">View Details</NavLink>
|
||||
@if (Type == MessageType.Error && UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
|
||||
{
|
||||
<NavLink class="ms-2" href="@NavigateUrl("admin/log")">View Details</NavLink>
|
||||
}
|
||||
<form method="post" @onsubmit="DismissModal" @formname="@_formname" data-enhance>
|
||||
<input type="hidden" name="__RequestVerificationToken" value="@SiteState.AntiForgeryToken" />
|
||||
<button type="submit" class="btn-close" aria-label="Close"></button>
|
||||
</form>
|
||||
}
|
||||
<form method="post" @onsubmit="DismissModal" @formname="@($"ModuleMessageForm{DateTime.UtcNow.ToString("yyyyMMddHHmmssfff", CultureInfo.InvariantCulture)}")" data-enhance>
|
||||
<input type="hidden" name="__RequestVerificationToken" value="@SiteState.AntiForgeryToken" />
|
||||
<button type="submit" class="btn-close" aria-label="Close"></button>
|
||||
</form>
|
||||
</div>
|
||||
}
|
||||
|
||||
@code {
|
||||
private string _message = string.Empty;
|
||||
private string _classname = string.Empty;
|
||||
private string _formname = "ModuleMessageForm";
|
||||
|
||||
[Parameter]
|
||||
public string Message { get; set; }
|
||||
|
@ -28,6 +31,14 @@
|
|||
[Parameter]
|
||||
public MessageType Type { get; set; }
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
if (ModuleState != null)
|
||||
{
|
||||
_formname += ModuleState.PageModuleId.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
_message = Message;
|
||||
|
|
Loading…
Reference in New Issue
Block a user