Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcodpt/form
A form component based on validator
https://github.com/marcodpt/form
bootstrap component form form-validation hyperapp json-schema
Last synced: 22 days ago
JSON representation
A form component based on validator
- Host: GitHub
- URL: https://github.com/marcodpt/form
- Owner: marcodpt
- License: mit
- Created: 2021-06-24T17:59:51.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-04T19:59:50.000Z (almost 3 years ago)
- Last Synced: 2024-11-14T01:18:24.597Z (3 months ago)
- Topics: bootstrap, component, form, form-validation, hyperapp, json-schema
- Language: JavaScript
- Homepage: https://marcodpt.github.io/component/?url=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fmarcodpt%2Fform%2Fsample.js
- Size: 41 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# form
> A form [component](https://github.com/marcodpt/component/) based on
[validator](https://github.com/marcodpt/validator/)[Live demo](https://marcodpt.github.io/component/?url=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fmarcodpt%2Fform%2Fsample.js)
[Tests](https://marcodpt.github.io/component/tests.html?url=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fmarcodpt%2Fform%2Ftests.js)
## Params
- object `schema`: json schema for the form, must be an object!
- string `alert`: alert to enclose schema description, like `success`,
`danger`, `warning`, `info`, etc
- array `messages`: An array of form information, itens are object with the
following properties:
- string `alert`: alert of the message, default `info`
- string `data`: text of the message
- boolean `close`: should it have a close button?
- function `back(messages)`: go back `action`
- function `submit(data, messages)`: submit `action`
- function `watch(data, messages)`: watch `action`
`action` is a function that return `null` or a new `object` if you want to
create a new form, or a new array of `messages` if you want to update messages## Update
- object `model`: A new data `model` to the form!