The simplest way, hands down, is to simply include the sfJqueryReloadedPlugin in your project. This also enables you to include the sfAdminDashPlugin which makes for easy navigation and a nice login screen for your back-end systems.
However, the problem with jQuery Reloaded, is that it is both old, and for our purposes, incomplete.
Since the last update to jQuery Reloaded, jQuery has progressed to version 1.4.2 (from 1.3.2), and more importantly jQuery UI has upgraded to 1.8.2 (from 1.7.3) and added some very nice and easy pieces we can use in our quest to simplify some of the widgets users are commonly presented.
The other problem we will run into with jQuery Reloaded, is that it doesn’t provide the CSS half of the jQuery UI library, meaning we would not be able to see any widgets we used properly.
So, with all this in mind, you now understand why in Part 2, I will be showing you how to roll your own jQuery plugin for Symfony.
Just a quick bit that I’m sure I will revisit later, but that I wanted to get out there sooner…
When embedded forms are saved, if you want to hook into the form save for the embedded form, use the saveEmbededForms function as save or doSave is never called on the embedded form.
The embedded form has it’s saveEmbeddedForms function called, and then $form->getObject()->save().
I need to get in touch with the Symfony devs and see if we can’t get some clarification on this setup in 2.0, as this “smells” wrong, but maybe it is just me.
One of the biggest problems with any user interface is ensuring the forms and controls are simple and straight forward to use. While Symfony comes with a great many of widgets that you can use in your forms, some of the most common ones are not as user friendly as one would hope.
I have added my jQuery Status Box Plugin to the site. There is a version for jQuery UI 1.7.x and one for jQuery UI 1.8.x. I hope you find it useful!
Update: I added a live example!
Quite a while back, SEO blog SEO 2.0 had a post entitled “Hey Freelancer: Are You a Worker or an Entrepreneur?” which really made me think.
Back when I was freelancing as my sole source of income, I was so caught up in being a worker, that I didn’t even realize I wasn’t working towards being an entrepreneur. This article woke me up a bit… too bad it was many months too late! 🙂
So how about the rest of you out there? Are you worker bees, or are you entrepreneurs?