Skip to content

mrtorrent/APYJsFormValidationBundle

 
 

Repository files navigation

Getting Started With JsFormValidationBundle

This bundle generate automatically a script to perform validations of a form in javascript.

It use the same constraints defined with annotations for your entity or your document.

This bundle is g11n compatible.(i18n + L10n)

Compatibility: Symfony 2.0+

Prerequisite

Installation

Please follow the steps given here to install this bundle.

Usage

This bundle is really easy to use. All you need is to call a twig function in your template.

{{ JSFV(form) }}

Template of a simple form:

<!-- MyProjectMyBundle:Default:index.html.twig -->

<!-- Include prerequisite librairies and bundles -->
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="{{ asset('bundles/bazingaexposetranslation/js/translation.js') }}"></script>
<script type="text/javascript" src="{{ url('bazinga_exposetranslation_js', { 'domain_name': 'validators' }) }}"></script>

<!-- Call JsFormValidationBundle -->
{{ JSFV(form) }}

<!-- Display the form -->
<form action="{{ path('myform') }}" method="post" {{ form_enctype(form) }}>
	{{ form_widget(form) }}
	<input type="submit" />
</form>

See a full simple example here.

The following documents are available:

  1. Installation
  2. Simple Example
  3. Twig Function
  4. Configuration
  5. Assets warmer
  6. Overriding the bundle
  7. Constraints warning

TODO

  • Script all possible constraints
  • Manage php, yml and xml defined constraints
  • Minify script with other compressor ?
  • Implement validation script with other javascript framework ?

About

This bundle performs validations of a form in javascript. (i18n compatible)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%