Comments (13)
I'm trying to figure this out myself @mrbarletta. If/when I figure it out I'll let you know.
from react.
I'm doing this:
import { Formio as FormioCore } from 'formiojs/full';
import { CustomSelectComponent } from '../../../controls/custom-formio/components';
FormioCore.registerComponent('custom-select', CustomSelectComponent);
But i get an error on this line in 'formiojs/build/components/Components.js' (line 457):
component.visible = false;
'component' is undefined. So i am stuck too :(
from react.
Has anyone come up against any kind of solution?
If we do create a custom component as shown in the link,
'https://github.com/formio/react-example/blob/master/src/app.jsx'
below code (line no 10 in above link) creates error of type "Cannot set property 'checkio' of undefined":
FormioComponents.checkio = require('./components/checkio.js');
My questions are:
- How to solve above error?
- What file works as renderer inside react-formio npm module?
- And therefore how to register this with the form renderer of react-formio?
from react.
great! this project needs some love! :)
from react.
The approach suggested by @Aiso786 above worked for me. I was able to duplicate the ES6 code of one of the stock components, change its class name and the name of the key string in the constructor, like this:
this.type = 'customComponentName';
And then import and register the component in the React app's componentDidMount()
function.
from react.
Looks like everyone figured it out. This approach will work with the 1.x version. In 2.x and later we depend on formio.js to render the form so the approach to build custom components is different. Here is how to do it in 2.x and 3.x branches https://gist.github.com/travist/59fa77086ec899e24992fc1508e61075
Note: The 4.x branch will change again (for the last time!) to support custom templating, SSR and better attaching of events.
from react.
how to have react-formio custom component?
from react.
@randallknutson - do you know how to create custom component with react-formio?
from react.
Hello Tk,
Have you seen this documentation? https://help.form.io/userguide/form-components/#custom
Please let me know if you have any further questions or concerns.
Thanks,
William Gay
Form.io Support
from react.
@wag110894 - thank you for the link. I can see there angular example, am I right? Can I find somewhere react example?
from react.
You can see an example of a custom component in react like this: https://github.com/formio/react-app-starterkit/tree/3.x/src/components
from react.
I feel like generating a unique element and render a react element to it, and then using something such as observable for syncing value in getValues and the element might be better?
from react.
Hello IniZio,
Can you please open this in a new chain. This issue has been non-responsive since March.
Thanks,
from react.
Related Issues (20)
- `readOnly` option change doesn't re-render the <Form /> editability status HOT 2
- How can I make reference to <Form /> from external javascript code ? HOT 1
- ReferenceError: navigator is not defined in Nextjs HOT 2
- importScript Error while Drag and Drap New Text field HOT 7
- Bug: Component Style Not Applied Correctly HOT 1
- adding custom component to formio . HOT 5
- React is null in @formio/react src/components HOT 2
- [BUG] Warning for Custom Components above React version 18 HOT 1
- "window is not defined" error in Next.js 14 HOT 8
- Plugins don't support asynchronous functions HOT 4
- I am using FormBuilder in the react functional base component and am not able to re-render Formio Builder on state change.
- Using an external button and Hebrew name in API HOT 4
- Formio Builder configuration with accessibility HOT 3
- Address field does not pre-fill when passing data into submission object HOT 3
- Drop babel-polyfill
- Parse library for data collected by form?
- Wierd custom onSubmit behavior
- Creating custom nested component - adding children HOT 3
- custom file component
- Add new variable are available in all scripts type data, row, component, instance HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react.