Uncaught Error: Form Input requires a name property when used
See original GitHub issueHi,
I’m trying to create custom input but always I’m getting this error. Anybody know why? Thank you!
var React = require('react');
var Dropzone = require('react-dropzone');
var Formsy = require('formsy-react');
var DropzoneUpload = React.createClass({
mixins: [Formsy.Mixin],
getInitialState: function() {
return {
files: null
};
},
onDrop: function(files) {
this.setState({
files: files
});
this.props.getFile(files);
},
changeValue: function (event) {
this.setValue(event.currentTarget.value);
},
render: function () {
var className = this.showRequired() ? 'required' : this.showError() ? 'error' : null;
var errorMessage = this.getErrorMessage();
return (
<div className={className}>
<Dropzone value={this.state.files} className="filedrag" onDrop={this.onDrop} onChange={this.changeValue}>
<div>Seleziona la immagine o trascinala nel riquadro</div>
</Dropzone>
{this.state.files ? <div className="fileUploaded"></div> : null}
</div>
);
}
});
module.exports = DropzoneUpload;
The form:
<Formsy.Form onValid={this.enableButton} onInvalid={this.disableButton} id="userProfile" ref="user-profile" className="user-profile">
<DropzoneUpload getFile={this.getUserFileDragged} />
</Formsy.Form>
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
React Form: Form Input requires a name property when used
I have created a form using formsy-react-2 but it's not working. I am getting. Error: Form Input requires a name property when used....
Read more >How to do Simple Form Validation in #Reactjs - Learnetto
We're adding a property called formErrors which will be an object with the input field names as keys and any validation errors as...
Read more >Composing React Components with TypeScript - This Dot Labs
For our Input component, we need the following props : defaultValue , onChange , placeholder and name . Each of them is a...
Read more >How to use React createRef - LogRocket Blog
Learn how to use the React.createRef() method and useRef Hook in React to simplify creating refs and interact with the HTML DOM.
Read more >event.target.name is undefined: What you need to know
You're likely getting this error because you're trying to get a name attribute on elements that don't have a name attribute. For example;...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Form Input requires a name property when used
I think this message could be clearer. For example, you may have an formsy component called
Input
in the form, but the error could be triggered by any of the other formsy components in the form.Maybe the following would be better?
Formsy components require a name prop
Can send a PR if you like.
@574196906 you should use own form element not just
input
. You can see example here