MSJD.FormSaver 1.0.5

dotnet add package MSJD.FormSaver --version 1.0.5
                    
NuGet\Install-Package MSJD.FormSaver -Version 1.0.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MSJD.FormSaver" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MSJD.FormSaver" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="MSJD.FormSaver" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MSJD.FormSaver --version 1.0.5
                    
#r "nuget: MSJD.FormSaver, 1.0.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MSJD.FormSaver@1.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MSJD.FormSaver&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=MSJD.FormSaver&version=1.0.5
                    
Install as a Cake Tool

FormSaver for Blazor

Advanced FormSaver Demo | LocalStorage + Encryption

FormSaver is a Blazor service that enables automatic saving, restoring, and encryption of complex form data in the browser's local storage. It supports nested objects, offline draft saving, and secure storage without requiring a backend.


Features

  • 💾 Form Saving – Save form state locally using a custom button click.
  • 🔄 Restore Forms Instantly – Load previously saved form data anytime.
  • 🔐 Built-in Encryption – All data stored locally is encrypted for security.
  • 🏗 Supports Nested Objects – Handles complex forms with nested structures.
  • 🌐 Offline Friendly – No backend required; perfect for offline forms or drafts.
  • 🧰 Blazor Integration – Works seamlessly with EditForm, InputText, InputSelect, InputCheckbox, and InputDate.
  • Compatible with All Render Modes – Works with InteractiveServer, InteractiveWebAssembly, and standard Blazor server/client render modes.

Demo Preview

FormSaver Demo Preview

Try it live: FormSaver Demo


Simple Example

Inject the service in Program.cs:

builder.Services.AddFormSaver();

Razor component example:

@page "/simple-form"
@inject IFormSaver FormSaver

<EditForm Model="@User">
    <DataAnnotationsValidator />
    <ValidationSummary />

    <label>Full Name:</label>
    <InputText @bind-Value="User.FullName" class="form-control" />

    <label>Email:</label>
    <InputText @bind-Value="User.Email" class="form-control" />

    <label>Comment:</label>
    <InputTextArea @bind-Value="User.Comment" class="form-control" rows="3" />

    <div class="mt-2">
        <button type="button" class="btn btn-primary" @onclick="SaveForm">💾 Save</button>
        <button type="button" class="btn btn-secondary" @onclick="LoadForm">📂 Load</button>
        <button type="button" class="btn btn-danger" @onclick="DeleteForm">🗑 Delete</button>
    </div>
</EditForm>

@code {
    private string Key = "simpleForm";
    private UserModel User = new();

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender)
        {
            await FormSaver.InitializeAsync();
            var saved = await FormSaver.LoadAsync<UserModel>(Key);
            if (saved != null) User = saved;
        }
    }

    private async Task SaveForm() => await FormSaver.SaveAsync(Key, User);
    private async Task LoadForm() => User = await FormSaver.LoadAsync<UserModel>(Key) ?? new UserModel();
    private async Task DeleteForm() => await FormSaver.RemoveAsync(Key);

    public class UserModel
    {
        public string FullName { get; set; } = string.Empty;
        public string Email { get; set; } = string.Empty;
        public string Comment { get; set; } = string.Empty;
    }
}

API

Initialize FormSaver

await FormSaver.InitializeAsync();

Save Form

bool success = await FormSaver.SaveAsync("formKey", User);

Load Form

var model = await FormSaver.LoadAsync<UserModel>("formKey");

Delete Form

bool success = await FormSaver.RemoveAsync("formKey");

Important Note

FormSaver stores form data in browser local storage.
Do not try to save forms that include file uploads (images, PDFs, etc.), because files cannot be stored in local storage.
If your form contains files, exclude them or handle file uploads separately.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5 179 10/30/2025