davidkpiano / react-redux-form

Create forms easily in React with Redux.
https://davidkpiano.github.io/react-redux-form
MIT License
2.06k stars 252 forks source link

TypeError: "submit" is read-only in Firefox #1141

Closed davidhagg closed 6 years ago

davidhagg commented 6 years ago

The Problem

I've got a form setup that works just fine in Chrome and Edge, but in Firefox it throws an error.

this._node.submit = this.handleSubmit;

in form-component.js

Steps to Reproduce

I've setup a store with combineForms in conjunction with combineReducers. My form is pretty simple:

submitTheForm(contact) {
        const { dispatch } = this.props;

        dispatch(actions.setPending('pageforms.contact', true));

        let contactPromise = this.postContactForm(`${API_ROOT}/contact`, contact);

        dispatch(actions.submit('pageforms.contact', contactPromise));
    }

 render() {
return (
<Form model="pageforms.contact" onSubmit={(val) => this.submitTheForm(val)} className="contact-form row">

<button disabled={!this.props.isFormValid} type="submit" name="submit">Send</button>
</Form>
)
}

Expected Behavior

No error and rendered as it should

Actual Behavior

An error is shown TypeError: "submit" is read-only

davidkpiano commented 6 years ago

Would you like to submit a PR if you know the fix?

davidhagg commented 6 years ago

I can give it a try, but I'm not sure if I know the fix

davidhagg commented 6 years ago

found the issue, if the submit button has a name property name="submit" it does not work in Firefox. Removed that property and it now works!

davidkpiano commented 6 years ago

Nice! That's an interesting caveat.