Skip to content

Module · Veva.Modules.FormComponents

Forms, built in the designer.

Editors build forms from fields, steps and checks, with no form code. A Document Form saves the answers as documents of a model. A Generic Form turns them into a query string for a filter or a search, or hands them to a submit handler of yours.

dotnet add package Veva.Web.Essentials

Two forms

Save the answers, or search with them.

Both take the same fields. They differ in where the answers go.

Document Form

Saves

Writes into the documents system. Pick the model and the folders new documents go into, and each field's name is a field of that model.

  • Edit mode: the same form edits the document named by ?documentId=
  • Reference fields: visitors pick documents of another model
  • Files: uploads go into the media library, stored as asset references
  • Custom validators: check the answers together before they are saved

Generic Form

Filters or posts

Its values become the query string of a page you pick, or of the page it is on, so a Document List or a Web search there filters by them.

  • Live filters: Auto submit sends the form whenever a value changes
  • Keeps its values: with Query string behaviour set, the fields fill from the address again
  • Submit handler: set one, and it saves the answers instead, once per valid submit
  • Initial state: start the fields with fixed values, or values from code

Building blocks

Fields, steps and checks, ready to place.

An input for every value

Text, e-mail, number, range, date and time, checkboxes, radio buttons, drop-downs, files and hidden fields.

Conditional sections

Show a group of fields only when another field has a given value. Sub forms gather repeated fields into one.

Steps

Form steps split a long form into a wizard. The navigator lists the steps and moves back and forth.

PDF on submit

The PDF generator renders a layout of the answers to a PDF and hands it to its file handlers.

Validation and spam guards

Required fields, patterns, a validation summary, a sum to solve, or Google reCAPTCHA as an add-on.

Buttons that act

Submit, reset, set a field to a value, or run one of the form's actions such as Next or Back.

How a Document Form works

From a model to a saved document.

  1. 01

    Pick a model

    Set the form's Model, and the folders new documents go into.

    Document Form
  2. 02

    Add fields

    Place input fields in the form. Each one's Field name is a field of the model.

    FieldName
  3. 03

    Check

    Required fields and formats are checked before the form submits.

    ICustomFormValidator
  4. 04

    Save

    A valid submit adds a document to the model and shows the form's submitted view.

  5. 05

    Edit later

    With edit mode on, the same form opens a document from ?documentId=.

    Enable edit mode

For developers

Handle a submit in your own code.

Implement IFormSubmitHandler and pick it as a Generic Form's Submit handler. It runs once per valid submit, and its result decides what the visitor sees next.

Extension points

API

Hook into a form from your own code:

  • IFormSubmitHandler: saves or sends a Generic Form's answers
  • ICustomFormValidator: checks the answers together
  • IFormInitialStateProvider: fills the fields before the form shows
ContactHandler.cs
public class ContactHandler : IFormSubmitHandler
{
    private readonly ContactInbox _inbox;   // your own service

    public ContactHandler(ContactInbox inbox) => _inbox = inbox;

    public async Task<FormSubmitResult> HandleAsync(
        FormSubmitRequest request, CancellationToken cancellationToken = default)
    {
        string email = request.ValueAsString("email");
        if (await _inbox.IsBlockedAsync(email, cancellationToken))
            return FormSubmitResult.Invalid("email", "Use another address.");

        await _inbox.AddAsync(request.Values, cancellationToken);
        return FormSubmitResult.Success("Thanks. We will be in touch.");
    }
}

// services.AddNamed<IFormSubmitHandler, ContactHandler>();

Keep reading

Guides for this module.

All articles

Modules

What it is made of.

The ones marked Built in come with Veva.Web.Essentials. Add the others as packages, restart, and set them up in the site's settings.

Module library

Documents

Veva.Modules.Documents

Models and their documents, in the Documents section. Adds the Document List, Document, Linked documents and Document Form components.

Built in
dotnet add package Veva.Modules.Documents

Forms

Veva.Modules.FormComponents

Form fields of every kind, form steps, a sum to solve and the PDF generator, for the Document Form and the Generic Form.

Built in
dotnet add package Veva.Modules.FormComponents

HubSpot

Veva.Modules.Hubspot

Embeds a HubSpot form, so submissions go straight to HubSpot.

Add-on
dotnet add package Veva.Modules.Hubspot

Puppeteer

Veva.Modules.Puppeteer

Renders the PDF generator's layout as an A4 PDF in headless Chromium, with each website's margins, header and footer.

Add-on
dotnet add package Veva.Modules.Puppeteer

Mailchimp

Veva.Modules.Mailchimp

Adds the documents saved in a model, such as sign-ups from a Document Form, as subscribers to a Mailchimp audience.

Add-on
dotnet add package Veva.Modules.Mailchimp

Campaign Monitor

Veva.Modules.CampaignMonitor

Adds the documents saved in a model, such as sign-ups from a Document Form, as subscribers to a Campaign Monitor list.

Add-on
dotnet add package Veva.Modules.CampaignMonitor

Google reCAPTCHA

Veva.Modules.Components.GoogleReCaptcha

A reCAPTCHA field for forms such as the Document Form, to keep spam bots out.

Add-on
dotnet add package Veva.Modules.Components.GoogleReCaptcha

More of Veva

Explore the other features.

Each one is made of modules. Reference a package, restart, and its components are in the editor.

All features

Page builder

Compose pages from components, then preview and publish

Open

Components and data

Components that show, components that fetch, and the binding between them

Open

Documents

Structured content you list, filter and serve anywhere

Open

PDFs and signing

Form answers made into a PDF, downloaded or sent to be signed

Open

Assets

One media library, with images sized on request

Open

Search

Crawl, index and search the whole site

Open

AI and agents

The admin's AI assistant, and the MCP server coding agents connect to

Open

Veva core

BuildVeva(), modules, components, themes and hooks

Open

Tech stack

Plain .NET Blazor: three render modes, standard components

Open

Integrations

Data sources, sign-in, mail, analytics and media

Open

Module library

Every module: what comes with Essentials, and the add-ons

Open

Type to search the docs, components and API.

↑↓ to move ↵ to open Esc to close Search by Veva