4 votes

Form Storage V8

Form Storage V8 is an Umbraco version 8 compatible re-working of Kevin Giszewski's original Form Storage package.

As per the original, the new package offers a simple way to take user submitted data and store it into your database,  perfect for use with MVC Surface Controller forms.

This package comes with a datatype that you can place on any document to search the data.

Installation:

On install, this package will add three tables to your database.  You will need to remove these tables manually on uninstall (this prevents unintended data destruction).

You will need to add a few AppSettings keys to your web config.

Use one key to setup each form with it's fields like so:

<add key="FormStorage:ContactUs" value="name,address,email,phone,comments"/>

This adds the "ContactUs" form with the fields name, address, etc.  You may house as many forms as you wish.

 

Configuration:

You can optionally provide some configuration of how your fields are displayed when form submissions are listed in your back-office. The first example shows how to provide some more human-friendly names for your fields:

<add key="FormStorage:Translation:name" value="Name"/>

<add key="FormStorage:Translation:email" value="Email Address"/>

<add key="FormStorage:Translation:phone" value="Phone"/>

<add key="FormStorage:Translation:address" value="Address"/>

<add key="FormStorage:Translation:comments" value="Comments"/>

<add key="FormStorage:Translation:company" value="Company"/>

It is recommended that you create very simple field names that resemble the data closely.  The more human friendly names can change without any consequences to the data. N.B. these field name translations are used across all of your forms.

The V7 package offers some further configuration options:

1. The width of a field (in pixels) can be set (default is 100):

<add key="FormStorage:YourFormAlias:YourFieldName:width" value="150"/> ​

2. The horizontal alignment of a field can be set to leftright or center (default is center):

<add key="FormStorage:YourFormAlias:YourFieldName:align" value="left"/>

3. The visibility of a field can be set to true or false (default is true):

<add key="FormStorage:YourFormAlias:YourFieldName:visible" value="false"/>

 

Wire up your form:

In your MVC Surface Controller, add something like this to save submissions:

using FormStorage;

FormSchema.CreateSubmission("ContactUs",

new Dictionary<string, string> {

        { "name", m.Name },

        { "email", m.Email },

        { "address", m.Address},

        { "company", m.Company},

        { "phone", m.Phone},

        { "comments", m.Comments}

 });

 

Search the Results:

Create a datatype instance using "Form Storage", set the prevalue to your form alias and then drop the datatype onto a doctype of your choosing.

A sample datatype has been included with the install.

Many thanks again to Kevin for his excellent original!

Screenshots

Package owner

Scott Meikle

Scott Meikle

Scott has 228 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
Version 8.18.x (untested)

You must login before you can report on package compatibility.

Previously reported to work on versions: 8.13.x, 8.12.x, 8.11.x, 8.10.x

Package Information

  • Package owner: Scott Meikle
  • Created: 27/04/2019
  • Current version 0.1
  • .NET version 4.7.2
  • License MIT
  • Downloads on Our: 371

External resources