JQuery-UI verus SimpleForm for Rails Forms processing

Recently, I had a conversation with a colleague about using JQuery UI to layout form processing for a Ruby on Rails application. I cautioned them against it.

In general, I’ve found more success using the simple_form library for generating form processing. I’m a huge fan of JQuery itself and use it a lot, but I find JQuery UI to be less valuable. It seems over-engineered for what people use it for.

What I’ve found with JQuery UI sometimes is that people use it because it promises a lot of capability with not very much coding effort. But the challenge comes when there is debugging to do or when you want functionality that is not ‘out of the box’.

I had a customer very recently that brought me in to address some issues getting a complicated form to work on a project that used a lot of JQuery UI components. They had used these components and then tried to extend them because the functionality they wanted wasn’t exactly ‘out of the box’. It ended up being very complicated to debug and it took me close to a day to trace one of the defects back into the JQuery UI component itself — it was placing random extra elements in the DOM on the browser and causing some things to not work.

Debugging complicated JavaScript issues in the browser is more complicated than tracing rails exceptions on the server side.

simple_form, on the other hand, is a much simpler framework to use. Basically the views are very simple and styling and layout is determined through css. If you need any dynamic features on the form you can implement them using straight JQuery — which gives you a wealth of capability. Trying to add JQuery functions on top of JQuery UI components is much more complicated to debug.

Here’s a railscast on ‘simple_form’ – that’s a good place to start. It’s getting to become the most widely accepted way to do form processing for rails.

All this being said, using JQuery UI for to implement components of a view that aren’t related to forms processing may be the best way to go.

This entry was posted in code, jquery, open source, programming, rails, ruby on rails. Bookmark the permalink.