Symfony has a great form validation system. The only downside is that it requires the form to be submitted in order to check for any constraint violations. And sometimes, that means that user experience will suffer. And other times, a form submission only for error detection is just not possible. For example, I like to open small forms in modal windows. In this case, submitting the form means closing the modal. And detecting the error and re-opening the same modal with the new information is a painful process. In order to handle all these cases elegantly, I have a small Ajax routine which dynamically checks form constraints while the user completes the form. I still have server-side Symfony validation in place, because one can easily get around JavaScript verification. Read More
Tag: ajax
Ajax Requests in Symfony
Even if Symfony has a clean and beautiful way of handling forms and form submission, most website will at some point require some data to be exchanged silently between the client and server. And this is where an Ajax request comes in handy. Read More