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

Formsy causing other buttons to submit? #150

Closed
e-monson opened this issue Jun 25, 2015 · 4 comments
Closed

Formsy causing other buttons to submit? #150

e-monson opened this issue Jun 25, 2015 · 4 comments
Labels

Comments

@e-monson
Copy link

I don't know if this is really Formsy's fault, but I was hoping someone could point me in the right direction. I have a Formsy form that includes react-md-editor as one of its fields. The problem is that, if all the required fields are filled out and the submit button is enabled, the editing buttons on the Markdown editor also act as submit buttons, ruining the functionality of the editor. Any ideas as to what could be causing this?

@Semigradsky
Copy link
Collaborator

How about run stopPropagation submit event in your field?

@e-monson
Copy link
Author

Unfortunately, I just tried that, and it didn't work. Not even nativeEvent.stopImmediatePropagation works. I wonder if it's related to facebook/react#1691.

@e-monson
Copy link
Author

I was able to solve the problem by drilling down to the buttons themselves with document.getElementsByClassName and adding a click event listener calling e.preventDefault. Whew!

@wingleungchoi
Copy link

button without type-attributes; Formsy.Form will treat those buttons as submit buttons
adding type='button' can prevent this issue happen

 e.g. <button type='button' onClick={this.foo)}>foo</button>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants