When form requirements change often

When starting a project, we add fields in the database as per the technical specification supplied. For example, we might start with a customer table with a few fields. 

It is not long before more requirements surface. 

Companies change and so does requirements. 

In some cases, such as compliance or contracts, the information required can change depending on the machine, audit or new information that is required. 

For these use cases, it doesn’t make sense to have all of these fields in a traditional relational (or noSQL) database.

In some industries, changes need to happen quickly and dynamically. For example, someone doing audits of kitchen devices in the hospitality industry needs to have the power to change required fields for different sites, appliances and roles.

In this post, I want to explore the options for ever-changing forms and contracts – what tools and patterns are available to us to help us manage this better?

Contract Templates

Contracts come in all shapes and sizes. These include rental, legal and employment to name a few. 

Many of these can be semi-standard. For example, rental contracts might have a few permutations – sectional title, full title and daily/weekly rentals. One could create a text replace function where certain characters need to be extracted, such as double curly brackets – {{CustomerName}}. These fields can then be entered and the contract created. 

Form Builders

It is every developer’s dream to write a meta-system that writes code – many having the dream to build a system that caters for 80% of permutations of customer needs. Though form builders can assist with this, I have found that this is a goal marker that keeps on moving.

I do however believe that in many cases, a form builder makes a lot of sense. 

I recently came across formbuilder.online. It allows for a simple drag and drop interface that saves data back into JSON. It is easily initialised by the following code (if you have the CDN script installed):

jQuery($ => {
const fbTemplate = document.getElementById('build-wrap');

Exporting the form in HTML is easy. As the building and rendering generally happens in two different locations in the software, it uses two different libraries:

the formBuilder and the formRender:

const html = $('#render-container').formRender('html'); // HTML string

And saving the output into JSON:
const fbEditor = document.getElementById("build-wrap");
const formBuilder = $(fbEditor).formBuilder();
document.getElementById("saveData").addEventListener("click", () => {

console.log("external save clicked");
const result = formBuilder.actions.save();
console.log("result:", result);


Managing form data

In some cases, it would make sense to save the form data in lookup tables – especially if reporting will be a requirement. Generally, for most applications though, the full JSON result can be saved in a single field and be recalled as a whole when needed. 

A pattern I have seen that tends to work well is using a template type where the original template is saved and the result copies the template as a form that can be filled in.

Contract related requirements

To end off the requirements, I want to add a special section on other elements I’ve seen that are required for contracts:

  • Editable terms and conditions – these change from time to time and it is recommended to handle this in the same template mechanism
  • Signatures – there are multiple JavaScript libraries handling signatures. I quite like Signature pad, as it is easily implemented
    • Creation:
      var canvas = document.querySelector("canvas");
      var signaturePad = new SignaturePad(canvas);
    • Saving result:
      signaturePad.toDataURL("image/jpeg"); // save image as JPEG
  • History and data tracking –
    • Having a history table that tracks the logged-in user’s changes to contracts would be prudent.
    • Most code solution gives you the ability to track the IP of the device. In C# .NET Core, it can be done with the following code:
      var remoteIpAddress = Request.HttpContext.Connection.RemoteIpAddress;
      return remoteIpAddress.MapToIPv6().ToString();
  • PDF Creation – It would often be required for users to export signed contracts to PDF. There are many HTML to PDF converters, including the well-known iText. Always check the licensing terms to make sure you are not breaking the law.


Managing forms and contracts that change can be challenging. With current technology, there are solutions to make our lives a bit easier such as form builders and writing a simple find and replace function.

Make sure you meet all the legal requirements of the contract or audit!

Enjoy your business