Like validators, it is easy to write custom tunnels with Bee Form, however, the package "bee-form-tunnels" does include a number of basic tunnels for your convenience
Notice: Unlike other form libraries which also support parsing/formatting, Bee form does support parse errors, which means, when user input un-parsable values, like : "1a" for a number field we will have:
import {json} from "bee-form-tunnels";
const formConfig = {
"content": {
tunnel: [json],
},
};
<textarea {...fv.bind("content")} />
<pre>{JSON.stringify(fv.getData())}</pre>
import {intNumber} from "bee-form-tunnels";
const formConfig = {
"content": {
tunnel: [intNumber],
},
};
<input {...fv.bind("content")} />
<pre>{JSON.stringify(fv.getData())}</pre>
import {trim} from "bee-form-tunnels";
const formConfig = {
"content": {
tunnel: [trim],
},
};
<textarea {...fv.bind("content")} />
<pre>{JSON.stringify(fv.getData())}</pre>