Skip to main content

A semi-dynamic form builder to ease the pain developing large forms

First Dates

A TV casting application form with admin system.

A simple TV casting application form with admin system allowing staff to search and track the progress of the applicants, hosted on AWS infrastructure.

a semi-dynamic form builder was used to quickly define forms and render them

As there were a number of forms all slightly different, I developed a semi-dynamic form builder. The form definition was a simple C# class decorated with attributes.

public class CastingForm
    public string Age { get; set; }

    [Display(Name = "My email address")]
    [IgnorecaseRegularExpression(@"^[^@]+@[^@]+\.[^@]+$", true, ErrorMessage = "You must enter a valid email address")]
    public string Email { get; set; }

    [IgnorecaseRegularExpression(@"^.*\.(jpg|jpeg|png|gif)$", true, ErrorMessage = "Please make sure your image is either a jpg, gif or png")]
    [MaxFileSizeAttribute(1048576, ErrorMessage = "Please make sure your image is under 1MB")]
    [Display(Name = "Upload a photo. (max 1MB. Jpgs, pngs, and gifs only)")]
    public HttpPostedFileBase Photo { get; set; }


The form is then rendered as HTML via a simple, generic piece of Razor:

foreach (var question in Html.GetQuestions(Model))
    <div class="question">
        <div class="question-text">

            @if (!String.IsNullOrWhiteSpace(question.SupportingText))
                <div class="supporting-text">@Html.Raw(question.SupportingText)</div>
        <div class="answer @question.Id">
First Dates casting form
The rendered first dates form

I'm working on releasing the form builder as a separate piece of Open Source Software.

Related Projects

All skills


Get in touch to talk about your project or just ask me a question.