diff --git a/src/BlazorStrap-Docs/Samples/V5/Forms/InputFile/InputFile1.razor b/src/BlazorStrap-Docs/Samples/V5/Forms/InputFile/InputFile1.razor index 816be714..f979571c 100644 --- a/src/BlazorStrap-Docs/Samples/V5/Forms/InputFile/InputFile1.razor +++ b/src/BlazorStrap-Docs/Samples/V5/Forms/InputFile/InputFile1.razor @@ -4,6 +4,7 @@ + @code { private ModalClass Modal { get; set; } = new ModalClass(); private void OnFileChange(InputFileChangeEventArgs e) diff --git a/src/BlazorStrap-Docs/wwwroot/Samples/V5/Forms/InputFile/InputFile1.md b/src/BlazorStrap-Docs/wwwroot/Samples/V5/Forms/InputFile/InputFile1.md index 816be714..f979571c 100644 --- a/src/BlazorStrap-Docs/wwwroot/Samples/V5/Forms/InputFile/InputFile1.md +++ b/src/BlazorStrap-Docs/wwwroot/Samples/V5/Forms/InputFile/InputFile1.md @@ -4,6 +4,7 @@ + @code { private ModalClass Modal { get; set; } = new ModalClass(); private void OnFileChange(InputFileChangeEventArgs e) diff --git a/src/BlazorStrap.V4/BlazorStrap.V4.csproj b/src/BlazorStrap.V4/BlazorStrap.V4.csproj index 93724565..7cce314d 100644 --- a/src/BlazorStrap.V4/BlazorStrap.V4.csproj +++ b/src/BlazorStrap.V4/BlazorStrap.V4.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0 + net6.0;net7.0;net8.0 10.0 enable enable @@ -14,7 +14,7 @@ https://blazorstrap.io/ https://github.com/chanan/BlazorStrap BlazorStrap.V4 - 5.2.101 + 5.2.102-Preview1 @@ -25,6 +25,10 @@ + + + + diff --git a/src/BlazorStrap.V4/Components/Forms/BSForm.cs b/src/BlazorStrap.V4/Components/Forms/BSForm.cs index 187c7a92..d7071f5f 100644 --- a/src/BlazorStrap.V4/Components/Forms/BSForm.cs +++ b/src/BlazorStrap.V4/Components/Forms/BSForm.cs @@ -67,6 +67,8 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) formBuilder.AddEventPreventDefaultAttribute(8, "onreset", true); } formBuilder.AddAttribute(9, "ChildContent", EditFormChildContent); + formBuilder.AddAttribute(10, "FormName", FormName); + formBuilder.AddAttribute(11, "Enhance", Enhance); formBuilder.CloseComponent(); }; diff --git a/src/BlazorStrap.V4/Components/Forms/BSInput.cs b/src/BlazorStrap.V4/Components/Forms/BSInput.cs index fbd2111f..ee45508c 100644 --- a/src/BlazorStrap.V4/Components/Forms/BSInput.cs +++ b/src/BlazorStrap.V4/Components/Forms/BSInput.cs @@ -48,6 +48,9 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) builder.AddAttribute(9, "onfocus", OnFocusEvent); builder.AddMultipleAttributes(8, AdditionalAttributes); builder.AddAttribute(10, "multiple", IsMultipleSelect); +#if NET8_0_OR_GREATER + builder.AddAttribute(11, "name",NameAttributeValue ); +#endif if (Helper?.Id != null) { builder.AddAttribute(11, "id", Helper.Id); diff --git a/src/BlazorStrap.V4/Components/Forms/BSInputCheckbox.cs b/src/BlazorStrap.V4/Components/Forms/BSInputCheckbox.cs index bfa98397..751b3280 100644 --- a/src/BlazorStrap.V4/Components/Forms/BSInputCheckbox.cs +++ b/src/BlazorStrap.V4/Components/Forms/BSInputCheckbox.cs @@ -53,6 +53,9 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) builder.AddAttribute(10, "id", Helper.Id); } builder.AddAttribute(11, "disabled", IsDisabled); +#if NET8_0_OR_GREATER + builder.AddAttribute(12, "name",NameAttributeValue ); +#endif builder.AddMultipleAttributes(13, AdditionalAttributes); builder.AddElementReferenceCapture(14, elReference => Element = elReference); builder.CloseElement(); diff --git a/src/BlazorStrap.V5/BlazorStrap.V5.csproj b/src/BlazorStrap.V5/BlazorStrap.V5.csproj index a8eac468..1aeb58d2 100644 --- a/src/BlazorStrap.V5/BlazorStrap.V5.csproj +++ b/src/BlazorStrap.V5/BlazorStrap.V5.csproj @@ -1,6 +1,6 @@  - net6.0;net7.0 + net6.0;net7.0;net8.0 10.0 enable enable @@ -13,7 +13,7 @@ https://blazorstrap.io/ https://github.com/chanan/BlazorStrap BlazorStrap.V5 - 5.2.101 + 5.2.102-Preview1 @@ -24,6 +24,10 @@ + + + + diff --git a/src/BlazorStrap.V5/Components/Forms/BSForm.cs b/src/BlazorStrap.V5/Components/Forms/BSForm.cs index 28a429d4..c324514f 100644 --- a/src/BlazorStrap.V5/Components/Forms/BSForm.cs +++ b/src/BlazorStrap.V5/Components/Forms/BSForm.cs @@ -68,6 +68,8 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) formBuilder.AddEventPreventDefaultAttribute(8, "onreset", true); } formBuilder.AddAttribute(9, "ChildContent", EditFormChildContent); + formBuilder.AddAttribute(10, "FormName", FormName); + formBuilder.AddAttribute(11, "Enhance", Enhance); formBuilder.CloseComponent(); }; diff --git a/src/BlazorStrap.V5/Components/Forms/BSInput.cs b/src/BlazorStrap.V5/Components/Forms/BSInput.cs index 7625acea..e4ea6ebc 100644 --- a/src/BlazorStrap.V5/Components/Forms/BSInput.cs +++ b/src/BlazorStrap.V5/Components/Forms/BSInput.cs @@ -51,6 +51,9 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) builder.AddAttribute(9, "onfocus", OnFocusEvent); builder.AddMultipleAttributes(8, AdditionalAttributes); builder.AddAttribute(10, "multiple", IsMultipleSelect); +#if NET8_0_OR_GREATER + builder.AddAttribute(11, "name",NameAttributeValue ); +#endif if (Helper?.Id != null) { builder.AddAttribute(11, "id", Helper.Id); diff --git a/src/BlazorStrap.V5/Components/Forms/BSInputCheckbox.cs b/src/BlazorStrap.V5/Components/Forms/BSInputCheckbox.cs index 83f30215..da07741e 100644 --- a/src/BlazorStrap.V5/Components/Forms/BSInputCheckbox.cs +++ b/src/BlazorStrap.V5/Components/Forms/BSInputCheckbox.cs @@ -61,6 +61,9 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) builder.AddAttribute(12, "id", id); builder.AddMultipleAttributes(13, AdditionalAttributes); builder.AddElementReferenceCapture(14, elReference => Element = elReference); +#if NET8_0_OR_GREATER + builder.AddAttribute(15, "name",NameAttributeValue ); +#endif builder.CloseElement(); if (IsToggle) { diff --git a/src/BlazorStrap/BlazorStrap.csproj b/src/BlazorStrap/BlazorStrap.csproj index f649bfd2..41bf68d8 100644 --- a/src/BlazorStrap/BlazorStrap.csproj +++ b/src/BlazorStrap/BlazorStrap.csproj @@ -1,6 +1,6 @@  - net6.0;net7.0 + net6.0;net7.0;net8.0 10.0 enable enable @@ -13,7 +13,8 @@ https://blazorstrap.io/ https://github.com/chanan/BlazorStrap BlazorStrap - 5.2.101 + 5.2.102-Preview1 + 6.0 @@ -40,4 +41,8 @@ + + + + diff --git a/src/BlazorStrap/Shared/Components/Forms/BSFormBase.cs b/src/BlazorStrap/Shared/Components/Forms/BSFormBase.cs index 04597b0b..e1987b42 100644 --- a/src/BlazorStrap/Shared/Components/Forms/BSFormBase.cs +++ b/src/BlazorStrap/Shared/Components/Forms/BSFormBase.cs @@ -7,6 +7,16 @@ namespace BlazorStrap.Shared.Components.Forms public abstract class BSFormBase : BlazorStrapBase, IBSForm where TJustify : Enum { public event Action? OnResetEventHandler; + + /// + /// If enabled, form submission is performed without fully reloading the page. This is + /// equivalent to adding data-enhance to the form. + /// + /// This flag is only relevant in server-side rendering (SSR) scenarios. For interactive + /// rendering, the flag has no effect since there is no full-page reload on submit anyway. + /// + [Parameter] public bool Enhance { get; set; } + /// /// Form alignment. /// @@ -17,6 +27,12 @@ public abstract class BSFormBase : BlazorStrapBase, IBSForm wh /// [Parameter] public EditContext? EditContext { get; set; } + /// + /// Gets or sets the form handler name. This is required for posting it to a server-side endpoint. + /// It is not used during interactive rendering. + /// + [Parameter] public string? FormName { get; set; } + /// /// Gutters /// diff --git a/src/BlazorStrap/Shared/Components/Forms/BSInputFileBase.cs b/src/BlazorStrap/Shared/Components/Forms/BSInputFileBase.cs index 56ae20d9..07837ecd 100644 --- a/src/BlazorStrap/Shared/Components/Forms/BSInputFileBase.cs +++ b/src/BlazorStrap/Shared/Components/Forms/BSInputFileBase.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; using Microsoft.AspNetCore.Components.Web; +using System.Globalization; using System.Linq.Expressions; namespace BlazorStrap.Shared.Components.Forms @@ -124,6 +125,7 @@ protected Task OnFileClick(MouseEventArgs e) var filechangevent = new InputFileChangeEventArgs(Array.Empty()); return OnFileChange(filechangevent); } + private void DoValidation() { diff --git a/src/BlazorStrap/Shared/Components/Forms/BlazorStrapInputBase.cs b/src/BlazorStrap/Shared/Components/Forms/BlazorStrapInputBase.cs index db4645b3..5e8fe0c8 100644 --- a/src/BlazorStrap/Shared/Components/Forms/BlazorStrapInputBase.cs +++ b/src/BlazorStrap/Shared/Components/Forms/BlazorStrapInputBase.cs @@ -83,10 +83,10 @@ public abstract class BlazorStrapInputBase : BlazorInputBase, IB CultureInfo @cultureInfo => BindConverter.FormatValue(@cultureInfo.Name), DateTime @dateTimeValue => BindConverter.FormatValue(@dateTimeValue, _dateFormat, CultureInfo.InvariantCulture), DateTimeOffset @dateTimeOffsetValue => BindConverter.FormatValue(@dateTimeOffsetValue, _dateFormat, CultureInfo.InvariantCulture), - #if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER DateOnly dateOnlyValue => BindConverter.FormatValue(dateOnlyValue, _dateFormat, CultureInfo.InvariantCulture), TimeOnly timeOnlyValue => BindConverter.FormatValue(timeOnlyValue, _dateFormat, CultureInfo.InvariantCulture), - #endif +#endif _ => base.FormatValueAsString(value), }; } @@ -312,4 +312,4 @@ private void Dispose() #endregion } -} +} \ No newline at end of file diff --git a/src/BlazorStrap/Utilities/BlazorInputBase.cs b/src/BlazorStrap/Utilities/BlazorInputBase.cs index c8ff9eeb..6e789e76 100644 --- a/src/BlazorStrap/Utilities/BlazorInputBase.cs +++ b/src/BlazorStrap/Utilities/BlazorInputBase.cs @@ -19,6 +19,12 @@ namespace BlazorStrap.Utilities; /// integrates with an , which must be supplied /// as a cascading parameter. /// + +#if NET8_0 +public abstract class BlazorInputBase : InputBase +{ +} +#else public abstract class BlazorInputBase : ComponentBase, IDisposable { @@ -304,4 +310,5 @@ void IDisposable.Dispose() Dispose(disposing: true); } -} \ No newline at end of file +} +#endif \ No newline at end of file