How can I create a simple web form?

I would like to create a simple form with a submit button tied to custom JS code that will create a set of records. Specifically, I am using the API from beta.sam.gov to automatically fetch business opportunities. From a UI perspective, all I need is a simple text input box and a submit button.

The documentation already explains how to create custom automation scripts, but
it appears all of the inputs must be already stored inside a corteza record. Practically what this means is to emulate a basic form behavior, I have to have my user create a new record (with fields that match the form inputs) and then to trigger automation when that new record is saved. This seems pretty silly, especially for extremely simple forms with a single input. I would be required to design a new module for every custom form I create. Furthermore, I would be saving every input that users enter into the form, which is unnecessary in this case.

I’ve checked the documentation and can’t seem to find how to make a simple web form without creating a record to represent the form values. Can someone help me?

If I understand this correctly, you wish to show this form from a Corteza page?
See my answer below, but I think the question was designed for you @Lenny.

If yes

You can’t currently create custom forms or custom input elements/page blocks.

What you could do is define a workflow with a series of prompts that could get you close to what you wish to do.
You would then represent that workflow as a button on the page.

If no

If you can/wish to submit the form from somewhere outside Corteza, you can define a sink route (a webhook) and bind a workflow/automation script to it.
The form creates an HTTP request to the sink route and the records are created.

Thanks. I do want to create a custom form (that’s a yes). In my case, I think I can get away with using a prompt.

The question remains …

But suppose I wanted a form with ~5 entries. Would each field have to be implemented as a separate prompt? There doesn’t seem to be a way to have a prompt with multiple input fields.

Generally, I would think it would nice if we could create our own custom block types, where system integrators can supply their own Vue.js (or something similar) to define new UI elements. I understand that building something like this might be complicated, but it would be very powerful for your users and would allow them to build things more complicated than forms. Is there anything like this on the roadmap for a future release?

Thanks for pinging me, Tjerman.

Hi Truemerrill. This is an interesting use case you have.

So, prompts look like a good solution. There are multiple prompts:

However, as you mention, there is no prompt yet with multiple inputfields at one. To make this work dynamically you could store the questions you want to have in the prompts in records, and iterate over them in a workflow, showing the correct promote for each. So, instead of having on prompt with multiple fields, it would be a set of prompts, each with one field.

Hope this helps you :slight_smile:

With regard to creating your own custom block types: it’s an open-source project, so anyone can create new features and make pull-requests :slight_smile: Of course, this needs coding skills. Alternatively, you can create feature-requests on Github too, which will then be evaluated.