+/**
+ * Description: implements a form
+ * Copyright (c) 2013 UPMC Sorbonne Universite
+ * License: GPLv3
+ */
+
+/*
+ * It's a best practice to pass jQuery to an IIFE (Immediately Invoked Function
+ * Expression) that maps it to the dollar sign so it can't be overwritten by
+ * another library in the scope of its execution.
+ */
+(function($){
+
+ /***************************************************************************
+ * Method calling logic
+ ***************************************************************************/
+
+ $.fn.CreateForm = function( method ) {
+ if ( methods[method] ) {
+ return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
+ } else if ( typeof method === 'object' || ! method ) {
+ return methods.init.apply( this, arguments );
+ } else {
+ return undefined;
+ //$.error( 'Method ' + method + ' does not exist on jQuery.CreateForm' );
+ }
+ };
+
+ /***************************************************************************
+ * Public methods
+ ***************************************************************************/
+
+ var methods = {
+
+ /**
+ * @brief Plugin initialization
+ * @param options : an associative array of setting values
+ * @return : a jQuery collection of objects on which the plugin is
+ * applied, which allows to maintain chainability of calls
+ */
+ init : function ( options ) {
+ return this.each(function() {
+ var $this = $(this);
+
+ /* An object that will hold private variables and methods */
+ var form = new CreateForm(options);
+ $this.data('plugin', form);
+
+ $(this).on('validate.Form', form.validate);
+ $(this).on('validate', form.validate);
+
+ }); // this.each
+ }, // init
+
+ };
+
+ /***************************************************************************
+ * CreateForm object
+ ***************************************************************************/
+
+ function CreateForm(options) {
+
+ /* save a reference to this */
+ var obj = this;
+
+ /* member variables */
+ this.options = options;
+
+ /* methods */
+
+ this.on_result = function(data) {
+