Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown props onValidSubmit, onSubmitted on <form> tag #361

Closed
16292 opened this issue Jul 2, 2016 · 2 comments
Closed

Unknown props onValidSubmit, onSubmitted on <form> tag #361

16292 opened this issue Jul 2, 2016 · 2 comments

Comments

@16292
Copy link

16292 commented Jul 2, 2016

Hi,

I am new here and try to make the login example work. I get this error:

Warning: Unknown props onValidSubmit, onSubmitted on <form> tag. Remove these props from the element. For details, see https://fb.me/react-unknown-prop
in form (created by Formsy)
in Formsy (created by App)

import React, { Component } from 'react';
import { Form } from 'forms-react';





import Formsy from 'forms-react';


const MyInput = React.createClass({

    // Add the Formsy Mixin
    mixins: [Formsy.Mixin],

    // setValue() will set the value of the component, which in
    // turn will validate it and the rest of the form
    changeValue(event) {
        this.setValue(event.currentTarget[this.props.type === 'checkbox' ? 'checked' : 'value']);
    },
    render() {

        // Set a specific className based on the validation
        // state of this component. showRequired() is true
        // when the value is empty and the required prop is
        // passed to the input. showError() is true when the
        // value typed is invalid
        const className = 'form-group' + (this.props.className || ' ') +
              (this.showRequired() ? 'required' : this.showError() ? 'error' : '');

        // An error message is returned ONLY if the component is invalid
        // or the server has returned an error message
        const errorMessage = this.getErrorMessage();

        return (
            <div className={className}>
                <label htmlFor={this.props.name}>{this.props.title}</label>
                <input
                    type={this.props.type || 'text'}
                    name={this.props.name}
                    onChange={this.changeValue}
                    value={this.getValue()}
                    checked={this.props.type === 'checkbox' && this.getValue() ? 'checked' : null}
                    />
                <span className='validation-error'>{errorMessage}</span>
            </div>
        );
    }
});

export default MyInput;




// App component - represents the whole app
export default class App extends Component {
    constructor(props) {
        super(props)

        this.state = {canSubmit: false }
    }
    submit(data) {
        alert(JSON.stringify(data, null, 4));
    }
    enableButton() {
        this.setState({ canSubmit: true });
    }

    disableButton() {
        this.setState({
            canSubmit: false,
        });
    }
    render() {
        return (
            <Form  className="login">
                <MyInput name="email" title="Email" validations="isEmail" validationError="This is not a valid email" required />
                <MyInput name="password" title="Password" type="password" required />
                <button type="submit" disabled={!this.state.canSubmit}>Submit</button>
            </Form>
        );
    }
}

Anyone can help me please ?

@graphman65
Copy link

I'm facing the exact same issue.

@philwhln
Copy link

philwhln commented Jul 5, 2016

Same here. This is related to a very recent React update 15.2.0. Discussion on the React-side is here
https://gist.github.com/jimfb/d99e0678e9da715ccf6454961ef04d1b

sdemjanenko added a commit to meraki/mki-formsy-react that referenced this issue Jul 11, 2016
* christ/master:
  0.18.1
  Fixed christianalfoni#335: getErrorMessages is undocumented in API
  Fixed christianalfoni#298: RangeError: Maximum call stack size exceeded with custom validator
  Fixed uncontrollable/controllable components in examples
  Fixed christianalfoni#361: Unknown props `onValidSubmit`, `onSubmitted` on <form> tag
  Use better names for components wrapped into HOC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants