gcanti / tcomb-form

Forms library for react
https://gcanti.github.io/tcomb-form
MIT License
1.16k stars 136 forks source link

Buttons in the List component should have type="button" #218

Closed leoasis closed 8 years ago

leoasis commented 8 years ago

Hi! First of all, awesome library, super flexible and powerful.

Just stumbled upon this "bug". If you wrap your Form component inside a form (as it is an usual use case, I think), you get the default submit on 'Enter' behavior. The problem is that buttons, by default, have the submit behavior in this case, and the first one will be clicked whenever the user hits enter in any other field. The buttons generated in the default component and templates in Lists don't specify the type of the button, and they trigger this default behavior, which I think is not correct. The buttons to add/remove/reorder elements in the list should have the type="button" attribute so that this doesn't happen.

In case I'm missing something, or am completely wrong, let me know :P

Thanks again!

gcanti commented 8 years ago

Hi @leoasis,

The buttons to add/remove/reorder elements in the list should have the type="button" attribute so that this doesn't happen

You are right, thanks for pointing out. I'll fix that asap

gcanti commented 8 years ago

Released a new version of uvdom-bootstrap https://github.com/gcanti/uvdom-bootstrap/releases/tag/v0.2.4 Re-installing tcomb-form with a fresh dependency should fix this issue.

leoasis commented 8 years ago

Wow that was fast, thanks a lot!

gcanti commented 8 years ago

Thanks to you @leoasis