Branchform ยท Free form builder

Build a Conditional jQuery Form and Export Working HTML

A workshop inquiry needs different questions for one visitor and a group. With Branchform, you can connect those questions to an earlier answer, inspect the resulting payload and keep an editable project alongside the exported form.

Start with the workshop inquiry

Download the free Branchform package, extract it and open app/index.html in a modern browser. The editor opens with the included workshop example. The package bundles jQuery 3.7.1 and its local runtime, so you can work from the extracted files.

The example asks whether the visitor is booking for Myself or A group. Both paths ask for a name, email address and workshop choice. The group path also shows participant count and a preferred date. You can start with these fields before adapting the labels to your own inquiry.

Show a question only when it applies

  1. Select a field in the editor. Set its label, type and requirements, then apply the changes. Use Add field when you need another question.
  2. Use Show when to connect that field to an earlier dropdown, radio or checkbox answer. For the workshop participant field, choose the booking question and its A group answer.
  3. Switch the booking answer in Preview. The participant and date fields should appear for A group and disappear for Myself. Check both paths after changing a condition.

The saved workshop project expresses the participant rule as follows:

{
  "id": "group_size",
  "type": "number",
  "label": "Number of participants",
  "required": true,
  "min": 2,
  "max": 14,
  "showWhen": { "field": "booking", "equals": "A group" }
}

Keep the triggering question earlier in the form. The rule points to its field ID, booking, while the visible label can describe that question in language your visitors understand.

Test the visible fields and their payload

Use synthetic details for your checks. For a group inquiry, choose A group, enter a fictional name and email, select a workshop and set the participant count to 5. Choose Test submission in the editor preview and inspect the payload.

In the independently checked browser example, selecting the group branch revealed the group questions, and the preview payload included the synthetic name and five participants. Hidden fields are absent from submission payloads. Repeat the check with Myself and confirm the group-only fields are absent rather than relying on appearance alone.

Also try missing required answers and an invalid email. After adding, moving or removing a field, recheck the relevant branch. A condition that looks correct before editing can still point to the wrong question afterward.

Keep the editable project and the exported HTML

  1. Choose Save project to download the JSON project. Keep this file as the editable source.
  2. Choose Open project and reopen that exact JSON. Verify the title, fields and group condition. In the checked roundtrip, saving the reopened project produced byte-identical JSON.
  3. Choose Export HTML, then open the downloaded HTML in a separate browser tab. Select the group branch again and test local validation.

The exported HTML contains its runtime and works offline. The checked exported form ran the group workflow without a network connection. Keep both files: JSON is for reopening the editor project, while HTML is the working form you can review or hand off.

Embed the jQuery form in an existing site

Open samples/embed.html for the packaged integration and its second independent form instance. Load app/form.css, then jQuery, app/core.js and app/jquery.branchform.js in that script order. Mount the saved project object on your own container:

jQuery('#inquiry').branchform(project, {
  async submit(payload) {
    const response = await fetch('/api/inquiry', {
      method: 'POST',
      headers: {'Content-Type': 'application/json'},
      body: JSON.stringify(payload)
    });
    if (!response.ok) throw new Error('Submission rejected');
  }
});

Here, project is the saved project object and /api/inquiry is an endpoint you implement. The callback comes from the package documentation. Test the endpoint's success and rejection paths in your application; copying this snippet alone does not create that endpoint.

Try the local receiver before building your own

From the extracted package directory, run python3 scripts/receiver.py --port 8765 and open the loopback URL it prints. The sample receiver validates the workshop fields again and returns an acknowledgement. It neither stores nor forwards the submission.

Follow the documented checks with an individual inquiry, a group of four and a fractional group size. The fractional group should be rejected by the sample receiver while the form remains available for correction. This is a development example: implement matching server validation, request limits, abuse protection, privacy handling and storage for your production receiver.

Choose the right starting point

Branchform fits a developer who needs conditional questions, an editable project and a portable form. If your main task is responsive contact-form markup and styling, see the Fieldfolio contact-form guide. For a WordPress inquiry workflow with a private inbox, see the Inletform guide.

Before launch, test the actual embed at narrow and wide widths, use the keyboard to reach its fields, verify both branches and confirm what happens when your receiver rejects a request. Branchform's free package includes the editor, conditional fields, validation, JSON project files, HTML export, workshop sample and integration documentation. Personal and commercial use follow the included license.