简体   繁体   中英

Forms and form validation in Rails 3: build your own vs Formtastic vs SimpleForm vs other gems?

Forms offer no differentiation value for your service, but most web sites need them obviously.

So far, we're building our own forms, but we would like to see how others approach forms -- especially form validation and attractive error messages -- and whether there is a more streamlined approach we're missing.

We're on Rails 3.

1) Our research has yielded Formtastic and SimpleForm as the most popular gems. Which others have you tried?

2) What are the pros/cons for your current approach?

3) We can't find demos (live working examples) of Formtastic or SimpleForm. Yes, we could download the code and do it ourselves, but we're wondering if there are live examples we could play with first.

Thanks!

I would most definitely recommend to use either formtastic or simple-form. While both are somewhat similar (their API is almost identical), the philosophy is a bit different.

Formtastic to get started, it is supplied with a default css, it generates semantically rich and correct markup. SimpleForm has the advantage that is extremely configurable, and will allow to configure the HTML that is generated completely. And it does not come with a default css. So simple-form should be used if you are trying to implement a HTML that is defined by someone else (eg your designer). Formtastic is just awesome if there is no specific (beforehand defined) design to follow.

With Formtastic being on the brink of their 2.0 release, it will get even more easier to extent Formtastic, I wholeheartedly recommend using Formtastic. The amount of code you need to write to get a nice form is so much less, it is so much easier, that it seems just plain stupid to not use it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM