@robinpath/form
v0.2.1
Published
Declarative form builder for RobinPath scripts — define fields inline, generate schemas, validate submissions
Readme
@robinpath/form
Declarative form builder — define fields inline in RobinPath scripts to generate form schemas, validate submissions, and embed forms anywhere
Why use this module?
The form module lets you:
- Generate embeddable forms
- Build multi-step wizards
All functions are callable directly from RobinPath scripts with a simple, consistent API.
Installation
npm install @robinpath/formQuick Start
No credentials needed — start using it right away:
form.textarea "bio" {"label": "Bio", "maxLength": 1000}Available Functions
| Function | Description |
|----------|-------------|
| form.text | Declare a text input field |
| form.textarea | Declare a multi-line text field |
| form.number | Declare a number input field |
| form.email | Declare an email input field |
| form.url | Declare a URL input field |
| form.phone | Declare a phone number input field |
| form.password | Declare a password input field |
| form.select | Declare a single-select dropdown |
| form.multiselect | Declare a multi-select field |
| form.checkbox | Declare a checkbox field |
| form.radio | Declare a radio button group |
| form.date | Declare a date input field |
| form.time | Declare a time input field |
| form.datetime | Declare a date-time input field |
| form.file | Declare a file upload field |
| form.hidden | Declare a hidden field |
| form.color | Declare a color picker field |
| form.range | Declare a range slider field |
| form.json | Declare a JSON input field |
| form.config | Set form-level configuration (title, submitLabel, etc.) |
| form.getForm | Get the complete form schema |
| form.validate | Validate data against declared fields |
| form.setData | Inject submitted form data |
| form.reset | Clear all fields, config, and data |
| form.group | Define a visual field group |
| form.step | Define a multi-step wizard step |
| form.toEmbed | Generate embed code (iframe, script, web component) |
Examples
Declare a multi-line text field.
form.textarea "bio" {"label": "Bio", "maxLength": 1000}Declare a number input field.
form.number "age" {"label": "Age", "min": 0, "max": 120}Declare an email input field with automatic email format validation.
form.email "email" {"label": "Email", "required": true}Integration with RobinPath
import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/form";
const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);
const result = await rp.executeScript(`
form.textarea "bio" {"label": "Bio", "maxLength": 1000}
`);Full API Reference
See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.
Related Modules
@robinpath/formdata— HTTP multipart FormData builder and file uploads (renamed from the oldformmodule)@robinpath/validate— Additional validation utilities@robinpath/schema— JSON schema validation@robinpath/hubspot— CRM integration for lead capture forms@robinpath/slack— Team notifications from form submissions@robinpath/shopify— E-commerce product creation from forms
License
MIT
