Skip to content

steve-todorov/symfony2-angular-forms

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

symfony2-angular-forms

Trying out Symfony2 forms with Angular form validation

The purpose of this repository is to combine Symfony (2.3) forms and AngularJs (1.2) form validition to create a nice user experience.

Why use Symfony forms?

Symfony forms are easy to deal with. Creating forms, binding models on, validating them, extending them and outputting them is al fairly easy. Symfony 2.3 Forms reference

Why use AngularJs form validation?

AngularJs form (and field) directives offer the ability to easily do client side validation and checks for changes in the fields and form. Angular 1.2 Form directive reference

So what are we trying to do here?

The art of combining those two is not simple. We don't want to duplicate all the validation rules, manually add Angular directives on the form elements (ngModel, ngRequired, ...). We don't want to have a page reload when the form submits and we do want to get the Symfony validation errors back.

In this repository I set up a simple example doing all this.

I'll write a blog post on how I achieved this later.

Disclaimer

I'm not using best practices in the backend here: saving/reading contacts happens in the controller, no real "domain", public properties, no test.

In the front-end it's a bit better, I do have controllers and services, but still no tests ...

About

Trying out Symfony2 forms with Angular forms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 70.5%
  • JavaScript 13.9%
  • HTML 12.0%
  • ApacheConf 3.5%
  • CSS 0.1%