https://github.com/jadesrochers/formbuilder
Components to create a selection form. The select boxes can be setup to adjust their values based on other boxes.
https://github.com/jadesrochers/formbuilder
form react selectors
Last synced: 2 months ago
JSON representation
Components to create a selection form. The select boxes can be setup to adjust their values based on other boxes.
- Host: GitHub
- URL: https://github.com/jadesrochers/formbuilder
- Owner: jadesrochers
- License: mit
- Created: 2019-10-24T19:40:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-07T15:25:53.000Z (over 1 year ago)
- Last Synced: 2025-02-26T11:47:40.273Z (3 months ago)
- Topics: form, react, selectors
- Language: JavaScript
- Size: 2.41 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Formbuilder; for selection forms with changing fields
The form library is aimed specifically at forms where changing one field
can change the options in the other fields.#### Set up using the Form and Selector components -
RegSelectors will hold a static set of selections, while UpdateSelectors
fields can change based on the variables in other Selectors.
#### Each selector needs a dataget fcn/object to set the contents
This can be a function that retrieves data or just an array that specifies
what the options will be.
For UpdateSelectors it needs to be a fcn because the UpdateSelector will call
it anytime the specified other fields (changeon) change.
RegSelectors will just call it/use it once to populate the selector.
#### The form needs a submit fcn
The submit function will be passed the values stored in each selector, as well
as the submit event. I found the event hard to work with so it is just there
if anyone else prefers that format.
#### Also takes a defaultval
The argument is optional, but there is a good chance the Selector will not
pick the default value you want, since there are a lot of possible formats,
values and sorting preferences.
#### Selector variable sorting is alphabetical/numeric by default -
I just try and get it to do ascending order alpha/numeric sort as consistently
as possible.### Example setup
Two RegSelectors and and UpdateSelector that will update its values if either
of the others changes.
```javascript
import { Form, RegSelector, UpdateSelector } from '@jadesrochers/formbuilder'
const Form = (props) => {
return(
)
}
```