diff --git a/dist/jquery.jsForm-1.1.3.js b/dist/jquery.jsForm-1.1.3.js
new file mode 100644
index 0000000..99fa1c4
--- /dev/null
+++ b/dist/jquery.jsForm-1.1.3.js
@@ -0,0 +1,2963 @@
+/**
+ * jquery.jsForm
+ * -------------
+ * JsForm control for handling html UI with json objects
+ * @version 1.0
+ * @class
+ * @author Niko Berger
+ * @license MIT License GPL
+ */
+;(function( $, window, undefined ){
+ "use strict";
+
+ var JSFORM_INIT_FUNCTIONS = {}, // remember initialization functions
+ JSFORM_MAP = {}; // remember all forms
+
+
+ /**
+ * @param element {Node} the cotnainer node that should be converted to a jsForm
+ * @param options {object} the configuraton object
+ * @constructor
+ */
+ function JsForm (element, options) {
+ var $this = $(element);
+
+ // create the options
+ this.options = $.extend({}, {
+ /**
+ * enable form control rendering (if jsForm.controls is available) and validation
+ */
+ controls: true,
+ /**
+ * the object used to fill/collect data
+ */
+ data: null,
+ /**
+ * the prefix used to annotate the input fields
+ */
+ prefix: "data",
+ /**
+ * set to null to discourage the tracking of "changed" fields.
+ * Disabling this will increase performance, but disabled the "changed" functionality.
+ * This will add the given css class to changed fields.
+ */
+ trackChanges: "changed",
+ /**
+ * set to false to only validate visible fields.
+ * This is discouraged especially when you have tabs or similar elements in your form.
+ */
+ validateHidden: true,
+ /**
+ * skip empty values when getting an object
+ */
+ skipEmpty: false,
+ /**
+ * an object with callback functions that act as renderer for data fields (class=object).
+ * ie. { infoRender: function(data){return data.id + ": " + data.name} }
+ */
+ renderer: null,
+ /**
+ * an object with callback functions that act as pre-processors for data fields (class=object).
+ * ie. { idFilter: function(data){return data.id} }
+ */
+ processors: null,
+ /**
+ * optional array of elements that should be connected with the form. This
+ * allows the splitting of the form into different parts of the dom.
+ */
+ connect: null,
+ /**
+ * The class used when calling preventEditing. This will replace all
+ * inputs with a span with the given field
+ */
+ viewClass: "value"
+ }, options);
+
+ // read prefix from dom
+ if($this.attr("data-prefix") && (this.options.prefix === "data" || this.options.prefix === "")) {
+ if($this.attr("data-prefix") !== "") {
+ this.options.prefix = $this.attr("data-prefix");
+ }
+ }
+
+ this.element = element;
+
+ this._init();
+ }
+
+ /**
+ * init the portlet - load the config
+ * @private
+ */
+ JsForm.prototype._init = function() {
+ // init the basic dom functionality
+ this._domInit();
+
+ // enable form controls
+ if(this.options.controls) {
+ if($.jsFormControls) {
+ // handle multiple form parts
+ $.each(this._getForm(), function(){
+ $(this).jsFormControls();
+ });
+ } else {
+ try {
+ if(typeof console !== "undefined") {
+ console.log("jquery.JsForm.controls not available!");
+ }
+ } catch(ex) {
+ // ignore
+ }
+ }
+ }
+
+ // fill/init with the first data
+ this._fill(this.options);
+ };
+
+ /**
+ * Connect a dom element with an already existing form.
+ * @param ele the new part of the form
+ */
+ JsForm.prototype.connect = function(ele) {
+ // collection lists with buttons
+ this._initCollection(ele, this.options.prefix);
+ // init conditionals
+ this._initConditional(ele, this.options.prefix, this.options);
+
+ // enable form controls
+ if(this.options.controls) {
+ if($.jsFormControls) {
+ // handle multiple form parts
+ $(ele).jsFormControls();
+ }
+ }
+
+ this._fillDom(ele);
+ if(!this.options.connect)
+ this.options.connect = [];
+ this.options.connect.push(ele);
+ };
+
+ /**
+ * @return all nodes for this jsform (main + connected)
+ */
+ JsForm.prototype.getNodes = function() {
+ return this._getForm();
+ };
+
+ /**
+ * init the dom. This can be called multiple times.
+ * this will also enable "add", "insert" and "delete" for collections
+ * @private
+ */
+ JsForm.prototype._domInit = function() {
+ var that = this;
+
+ // handle multiple form parts
+ $.each(this._getForm(), function(){
+ // collection lists with buttons
+ that._initCollection(this, that.options.prefix);
+ // init conditionals
+ that._initConditional(this, that.options.prefix, that.options);
+ });
+ };
+
+ /**
+ * simple debug helper
+ * @param msg the message to pring
+ * @private
+ */
+ JsForm.prototype._debug = function(msg, param) {
+ try {
+ if (!window.console || !window.console.log)
+ return;
+
+ var p = null;
+ if($.isPlainObject(param)) {
+ p = JSON.stringify(param, null, " ");
+ } else
+ p = param;
+
+ if(!p) {
+ p = "";
+ }
+
+ window.console.log(msg + p);
+ } catch(ex) {
+ // ignore
+ }
+ };
+
+ /**
+ * initialize conditionals.
+ * basic rule is:
+ * any dom element that has a conditional and either
+ * a data-show or data-hide attribute or a data-eval attribute
+ *
+ * @param form the base dom element
+ * @param prefix the prefix to check for
+ * @private
+ */
+ JsForm.prototype._initConditional = function(form, prefix, options) {
+ var that = this;
+ var showEvaluator = function(ele, data, fields) {
+ // if any field has a value -> show
+ var show = false;
+ $.each(fields, function(){
+ var value = that._getValueWithArrays(data, this);
+ if(!value || value === "" || value === 0 || value === -1)
+ return;
+ show = true;
+ // skip processing
+ return false;
+ });
+ if(show)
+ ele.show();
+ else
+ ele.hide();
+ }, hideEvaluator = function(ele, data, fields) {
+ // if any field has a value -> hide
+ var show = false;
+ $.each(fields, function(){
+ var value = that._getValueWithArrays(data, this);
+ if(!value || value === "" || value === 0 || value === -1)
+ return;
+ show = true;
+ // skip processing
+ return false;
+ });
+ if(show)
+ ele.hide();
+ else
+ ele.show();
+ };
+
+ // remember the conditionals for faster dom access
+ this.conditionals = $(form).find(".conditional");
+
+ this.conditionals.each(function(){
+ $(this).data().conditionalEval = [];
+ var fields = $(this).attr("data-show");
+ if(fields && fields.length > 0) {
+ $(this).data().conditionalEval.push({
+ func: showEvaluator,
+ field: fields.split(" ")
+ });
+ }
+ fields = $(this).attr("data-hide");
+ if(fields && fields.length > 0) {
+ $(this).data().conditionalEval.push({
+ func: hideEvaluator,
+ field: fields.split(" ")
+ });
+ }
+ fields = $(this).attr("data-eval");
+ if(fields && fields.length > 0) {
+ // custom evaluator
+ if(options.conditionals[fields])
+ $(this).data().conditionalEval.push({
+ func: options.conditionals[fields]
+ });
+ }
+ });
+ };
+
+ /**
+ * evaluate conditionals on the form
+ * @param form the form to search for conditionals
+ * @param data the data
+ */
+ JsForm.prototype._evaluateConditionals = function(form, data) {
+ this.conditionals.each(function(){
+ var ele = $(this);
+ // go throguh all evaluation functions
+ $.each(ele.data().conditionalEval, function() {
+ this.func(ele, data, this.field);
+ });
+ });
+ };
+
+ /**
+ * initialize collections
+ * @param form the base dom element
+ * @param prefix the prefix to check for
+ * @private
+ */
+ JsForm.prototype._initCollection = function(form, prefix) {
+ // all collections
+ var collectionMap = {},
+ that = this;
+ $(form).data().collections = collectionMap;
+
+ $(".collection", form).each(function() {
+ var colName = $(this).attr("data-field");
+ // skip collections without a data-field mapping
+ if (!colName || colName.indexOf(prefix + ".") !== 0) {
+ return;
+ }
+
+ var container = $(this);
+
+ // remember the collection
+ var cols = collectionMap[colName];
+ if(cols) {
+ cols.push(container);
+ } else {
+ collectionMap[colName] = [container];
+ }
+
+ //init the collection
+ that._initList(container);
+
+ // after adding: check if we want reorder control
+ if(!container.hasClass("ui-sortable") && container.hasClass("sortable") && container.sortable) {
+ // get the config object
+ var config = container.attr("data-sortable");
+ if(!config) {
+ config = {};
+ } else {
+ config = JSON.parse(config);
+ }
+
+ container.sortable(config);
+ container.on("sortstop", function( event, ui ) {
+ that._reorder(container);
+ });
+ }
+
+ });
+
+ $(".add", form).each(function(){
+ var fieldName = $(this).attr("data-field");
+ if(!fieldName) {
+ return;
+ }
+
+ // only init once
+ if($(this).data("collections")) {
+ return;
+ }
+
+ // add the collection
+ $(this).data().collections = collectionMap[fieldName];
+
+ $(this).click(function(ev){
+ ev.preventDefault();
+
+ // search for a collection with that name
+ $.each($(this).data("collections"), function() {
+ var tmpl = $(this).data("template");
+
+ // and has a template
+ if(tmpl) {
+ var line = tmpl.clone(true);
+ $(line).addClass("POJO");
+ $(line).data().pojo = {};
+
+ var prefill = $(this).data("prefill");
+ if(!prefill)
+ prefill = $(this).val("data-prefill");
+ // allow prefill
+ if(prefill){
+ if($.isFunction(prefill))
+ prefill($(line).data().pojo, $(line));
+ else if(prefill.substring)
+ $(line).data().pojo = JSON.parse(prefill);
+ else if($.isPlainObject(prefill))
+ $(line).data().pojo = prefill;
+
+ }
+ $(this).append(line);
+
+ // init controls
+ that._enableTracking($("input,textarea,select", line));
+ // new line always has changes
+ if(that.options.trackChanges)
+ $("input,textarea,select", line).addClass(that.options.trackChanges);
+
+ that._addCollectionControls(line);
+
+ // its possible to have "sub" collections
+ that._initCollection(line, fieldName.substring(fieldName.indexOf('.')+1));
+
+ // trigger a callback
+ $(this).trigger("addCollection", [line, $(line).data().pojo]);
+
+ // the new entry has as index the count of all "lines"
+ var idx = $(this).children(".POJO").length;
+
+ // "fill data"
+ that._fillData(line, $(line).data().pojo, fieldName.substring(fieldName.indexOf('.')+1), idx);
+
+ // trigger a callback after the data has been rendered)
+ $(this).trigger("postAddCollection", [line, $(line).data().pojo]);
+ }
+ });
+ });
+ });
+
+ // insert: similar to add - but works with events
+ $(".insert", form).each(function(){
+ var fieldName = $(this).attr("data-field");
+ if(!fieldName) {
+ return;
+ }
+
+ // only init once
+ if($(this).data("collections")) {
+ return;
+ }
+
+ // remember the collections
+ $(this).data("collections", collectionMap[$(this).attr("data-field")]);
+
+ $(this).on("insert", function(ev, pojo){
+ if(!pojo)
+ pojo = $(this).data().pojo;
+ // insert only works if there is a pojo
+ if(!pojo) {
+ return;
+ }
+ var beforeInsertCallback = $(this).data("beforeInsert");
+ if(beforeInsertCallback && $.isFunction(beforeInsertCallback)) {
+ pojo = beforeInsertCallback(pojo);
+
+ // insert only works if there is a pojo
+ if(!pojo) {
+ return;
+ }
+ }
+
+ // search for a collection with that name
+ $.each($(this).data("collections"), function() {
+ var tmpl = $(this).data("template");
+ // and has a template
+ if(tmpl) {
+ var line = tmpl.clone(true);
+ // mark that this is a pojo
+ line.addClass("POJO");
+ // add the pojo
+ line.data().pojo = pojo;
+
+ that._addCollectionControls(line);
+
+ // its possible to have "sub" collections
+ that._initCollection(line);
+
+ // trigger a callback
+ $(this).trigger("addCollection", [line, pojo]);
+
+ // the new entry has as index the count of all "lines"
+ var idx = $(this).children(".POJO").length;
+
+ // fill the "information"
+ that._fillData(line, pojo, fieldName.substring(fieldName.indexOf('.')+1), idx);
+
+ $(this).append(line);
+
+ // trigger a callback after the data has been rendered)
+ $(this).trigger("postAddCollection", [line, pojo]);
+ }
+ });
+
+ // empty field
+ $(this).val("");
+ $(this).data().pojo = null;
+ $(this).focus();
+ });
+ });
+
+ // insert: helper button (triggers insert)
+ $(".insertAction", form).each(function(){
+ var fieldName = $(this).attr("data-field");
+ if(!fieldName) {
+ return;
+ }
+
+ // only init once
+ if($(this).data("inserter")) {
+ return;
+ }
+
+ // find the insert element for this data-field
+ var inserter = $(this).parent().find(".insert");
+ if(!inserter) {
+ return;
+ }
+
+ // remember the inserter
+ $(this).data("inserter", inserter);
+
+ $(this).click(function(ev){
+ ev.preventDefault();
+ $(this).data("inserter").trigger("insert");
+ return false;
+ });
+
+ });
+
+ $("input.object", form).each(function(){
+ $(this).on("update", function(evt){
+ var pojo = $(this).data().pojo;
+ if (pojo && $(this).attr("data-display")) {
+ $(this).val(that._renderObject(pojo, $(this).attr("data-display")));
+ }
+ });
+ });
+
+ // fileupload
+ $("input.blob", form).each(function(){
+ // only available on input type file
+ if($(this).attr("type") !== "file") {
+ return;
+ }
+
+ var blobInput = $(this);
+
+ // bind on change
+ $(this).on("change", function(evt){
+
+ //get file name
+ var fileName = $(this).val().split(/\\/).pop();
+ blobInput.data("name", fileName);
+
+ var files = evt.target.files; // FileList object
+ // Loop through the FileList (and render image files as thumbnails.(skip for ie < 9)
+ if(files && files.length) {
+ $.each(files, function() {
+ var reader = new FileReader();
+
+ // closure to capture the file information
+ reader.onload = function(e) {
+ // get the result
+ blobInput.data("blob", e.target.result);
+ };
+
+ // Read in the image file as a data URL.
+ reader.readAsDataURL(this);
+
+ $(this).trigger("fileChange");
+ });
+ }
+ });
+
+
+ });
+ };
+
+ /**
+ * init a container that has a tempalate child (first child).
+ * @param container the contianer element
+ * @private
+ */
+ JsForm.prototype._initList = function(container) {
+ // avoid double initialisation
+ if(container.data("template")) {
+ return;
+ }
+
+ // get all children
+ var tmpl = container.children().detach();
+
+ // remove an id if there is one
+ tmpl.removeAttr("id");
+ container.data("template", tmpl);
+ };
+
+ /**
+ * generate the array with all dome elements that are conencted with
+ * the form.
+ * @private
+ */
+ JsForm.prototype._getForm = function() {
+ var form = [$(this.element)];
+ if(this.options.connect)
+ $.each(this.options.connect, function(){
+ form.push($(this));
+ });
+ return form;
+ };
+
+ /**
+ * clear/reset a form. The prefix is normally predefined by init
+ * @param form the form
+ * @param prefix the optional prefix used to identify fields for this form
+ */
+ JsForm.prototype._clear = function(form, prefix) {
+ // get the prefix from the form if not given
+ if(!prefix) {
+ prefix = this.options.prefix;
+ }
+
+ $(form).removeData("pojo");
+ $("input,select,textarea", form).each(function(){
+ var name = $(this).attr("name");
+ // empty name - ignore
+ if (!name || name.indexOf(prefix + ".") !== 0) {
+ return;
+ }
+ // cut away the prefix
+ name = name.substring((prefix+".").length);
+ // skip empty
+ if(name.length < 1) {
+ return;
+ }
+
+ // remove all pojos
+ $(this).removeData("pojo");
+
+ if($(this).attr("type") === "checkbox") {
+ $(this).prop("checked", false);
+ } else {
+ $(this).val("");
+ }
+ if($(this).hasClass("blob")) {
+ $(this).removeData("blob");
+ }
+ // special type select box: select the FIRST child
+ if($(this).is("select")) {
+ $('option[selected="selected"]', this).prop('selected', false);
+ $('option:first', this).prop('selected', true);
+
+ $(this).val($("option:first", this).val()).change();
+ }
+ // trigger change
+ $(this).change();
+ });
+
+ $(".collection", form).each(function() {
+ var fieldname = $(this).attr("data-field");
+ // only collections with the correct prefix
+ if(!fieldname || fieldname.indexOf(prefix+".") !== 0) {
+ return;
+ }
+ // get rid of all
+ $(this).empty();
+ });
+
+ };
+ /**
+ * ceate a pojo from a form. Takes special data definition classes into account:
+ *
+ * - number|currency: the content will be transformed into a number (default string
+ * - transient: will be ignored
+ * - prefix.fieldname.value: will create the whole object subtree
+ *
+ * @param start the element to start from (ie. the form or tr)
+ * @param pojo the pojo to write everything to
+ * @param prefix a prefix: only fields with the given prefix will be included in the pojo
+ * @private
+ */
+ JsForm.prototype._createPojoFromInput = function (start, prefix, pojo) {
+ // check if we have an "original" pojo
+ var startObj = null;
+ var that = this;
+
+ // get it from the starting dom element
+ if($(start).data("pojo")) {
+ startObj = $(start).data("pojo");
+ }
+
+ // if we have an object, use this as base and fill the pojo
+ if(startObj) {
+ $.extend(true, pojo, startObj);
+ }
+
+ $(start).find("input,select,textarea,.jsobject").each(function(){
+ var name = $(this).attr("data-name");
+ if(!name) {
+ name = $(this).attr("name");
+ }
+
+ // empty name - ignore
+ if (!name) {
+ return;
+ }
+
+ // skip grayed (=calculated) or transient fields
+ if($(this).hasClass("transient")) {
+ return;
+ }
+
+ // must start with prefix
+ if(name.indexOf(prefix + ".") !== 0) {
+ return;
+ }
+
+ $(this).trigger("validate", true);
+
+ // cut away the prefix
+ name = name.substring((prefix+".").length);
+
+ var val = $(this).val();
+
+ // jsobject use the pojo data directly - ignore the rest
+ if($(this).hasClass("jsobject")) {
+ val = $(this).data("pojo");
+ }
+ else {
+ // ignore empty values when skipEmpty is set
+ if(that.options.skipEmpty && (!val || val === "" || val.trim() === "")) {
+ return;
+ }
+
+ if($(this).hasClass("emptynull") && (!val || val === "" || val === "null" || val.trim() === "")) { // nullable fields do not send empty string
+ val = null;
+ } else if($(this).hasClass("object") || $(this).hasClass("POJO")) {
+ if($("option:selected", this).data() && $("option:selected", this).data().pojo) {
+ val = $("option:selected", this).data().pojo;
+ } else {
+ val = $(this).data("pojo");
+ }
+ // object can also have a processor
+ if($.isFunction($(this).data().processor)) {
+ val = $(this).data().processor(val);
+ } else {
+ var processor = $(this).attr("data-processor");
+ if(processor && that.options.processors[processor]) {
+ val = that.options.processors[processor](val);
+ }
+ }
+ } else if($(this).hasClass("blob")) { // file upload blob
+ val = $(this).data("blob");
+ } else
+ // set empty numbers or dates to null
+ if(val === "" && ($(this).hasClass("number") || $(this).hasClass("percent") || $(this).hasClass("integer") || $(this).hasClass("dateFilter")|| $(this).hasClass("dateTimeFilter"))) {
+ val = null;
+ }
+
+ // check for percentage: this is input / 100
+ if ($(this).hasClass("percent")) {
+ val = that._getNumber(val);
+ if(isNaN(val)) {
+ val = 0;
+ } else {
+ val /= 100;
+ }
+ }
+ else if ($(this).hasClass("number") || $(this).hasClass("integer")) {
+ if($(this).hasClass("date") && isNaN(val)) {
+ if($.format) {
+ var d = $.format.date(val);
+ d.setHours(0);
+ d.setMinutes(0);
+ d.setSeconds(0);
+ d.setMilliseconds(0);
+ val = d.getTime();
+ } else
+ val = new Date(val).getTime();
+ } else
+ val = that._getNumber(val);
+ if(isNaN(val)) {
+ val = 0;
+ }
+ }
+ else if($(this).attr("type") === "checkbox" || $(this).attr("type") === "CHECKBOX") {
+ // a checkbox as an array
+ if($(this).hasClass("array")) {
+ // the special case: array+checkbox is handled on the actual setting
+ val = $(this).val();
+ } else
+ val = $(this).is(':checked');
+ }
+ else if($(this).hasClass("bool")) {
+ val = ($(this).val() === "true");
+ }
+ }
+ // handle simple collection
+ if(name.length < 1) {
+ pojo = val;
+ return false;
+ }
+
+ // check if we have a . - if so split
+ if (name.indexOf(".") === -1)
+ {
+ // this might actually be an array!
+ if($(this).hasClass("array")) {
+ // create an array out of this
+ if(!pojo[name]) {
+ pojo[name] = [];
+ }
+
+ if($(this).attr("type") === "checkbox" || $(this).attr("type") === "CHECKBOX") {
+ // do we want the value of not
+ var use = $(this).is(":checked");
+ var pushVal = true;
+ $.each(pojo[name], function(data, index){
+ if(this == val) {
+ // dont need to push
+ pushVal = false;
+ // we dont use it - remove it
+ if(!use)
+ pojo[name].splice(index, 1);
+ return false;
+ }
+ });
+ if(pushVal && use)
+ pojo[name].push(val);
+ } else {
+ var num = $(this).attr("data-array");
+ if(!num || isNaN(num)) {
+ num = null;
+ } else
+ num = Number(num);
+
+ // no num -> add the array
+ if(num === null)
+ pojo[name].push(val);
+ else
+ pojo[name][num] = val;
+ }
+ }
+ else
+ pojo[name] = val;
+ }
+ else
+ {
+ var parts = name.split(".");
+
+ var d0 = pojo[parts[0]];
+ var d1, d2;
+
+ // multiple parts: make sure its an object TODO find a better way to handle multiple levels with auto-create
+ if (!d0 || !$.isPlainObject(d0)) {
+ pojo[parts[0]] = {};
+ d0 = pojo[parts[0]];
+ }
+
+ if (parts.length === 2) {
+ d0[parts[1]] = val;
+ } else if (parts.length === 3) {
+ d1 = d0[parts[1]];
+ if(d1 === undefined || d1 === null) {
+ d1 = {};
+ d0[parts[1]] = d1;
+ }
+ d1[parts[2]] = val;
+ } else if (parts.length === 4)
+ {
+ d1 = d0[parts[1]];
+ if(d1 === null || d1 === undefined) {
+ d1 = {};
+ d0[parts[1]] = d1;
+ }
+ d2 = d1[parts[2]];
+ if(d2 === undefined || d1 === null) {
+ d2 = {};
+ d1[parts[2]] = d2;
+ }
+ d1[parts[2]] = val;
+ d2[parts[3]] = val;
+ }
+ // more should not be necessary
+ }
+ });
+
+ return pojo;
+ };
+
+ /**
+ * helper function to enable tracking on fields
+ * @param ele the element to track
+ */
+ JsForm.prototype._enableTracking = function(ele) {
+ var that = this;
+ if(that.options.trackChanges && !$(ele).data().track) {
+ $(ele).data().track = true;
+ $(ele).change(function(){
+ if($(this).val() !== $(this).data().orig) {
+ $(this).addClass(that.options.trackChanges);
+ }else {
+ $(this).removeClass(that.options.trackChanges);
+ }
+ });
+ }
+ };
+
+ /**
+ * fill a dom subtree with data.
+ *
+ * - <span class="field">prefix.fieldname</span>
+ *
- <input name="prefix.fieldname"/>
+ *
- <a class="field" href="prefix.fieldname">linktest</a>
+ *
- <img class="field" src="prefix.fieldname"/>
+ *
+ * @param parent the root of the subtree
+ * @param data the data
+ * @param prefix the prefix used to find fields
+ * @param idx the index - this is only used for collections
+ * @private
+ */
+ JsForm.prototype._fillData = function (parent, data, prefix, idx) {
+ var that = this;
+ var $parent = $(parent);
+
+ // locate all "fields"
+ $parent.find(".field").each(function() {
+ var name = $(this).data("name");
+ if(!name) {
+ if(this.nodeName.toUpperCase() === 'A') {
+ name = $(this).attr("href");
+ $(this).attr("href", "#");
+ }else if(this.nodeName.toUpperCase() === 'IMG') {
+ name = $(this).attr("src");
+ if(name.indexOf("#") === 0) {
+ name = name.substring(1);
+ }
+ $(this).attr("src", "#");
+ }else {
+ name = $(this).text();
+ }
+ $(this).data("name", name);
+ $(this).show();
+ }
+
+ if(!prefix || name.indexOf(prefix + ".") >= 0) {
+ var cname = name;
+ if (prefix) {
+ cname = cname.substring(prefix.length + 1);
+ }
+ var cdata = that._get(data, cname, false, idx);
+
+ if(!cdata && cdata !== 0 && cdata !== false) {
+ cdata = "";
+ }
+
+ // check for percentage: this is value * 100
+ if ($(this).hasClass("percent") && !isNaN(cdata)) {
+ cdata = 100 * Number(cdata);
+ } else if($(this).hasClass("currency")) {
+ if (!cdata)
+ cdata = 0;
+ }
+
+ // format the string
+ if($.jsFormControls)
+ cdata = $.jsFormControls.Format.format(this, cdata);
+
+ if(this.nodeName.toUpperCase() === 'A') {
+ $(this).attr("href", cdata);
+ } else if(this.nodeName.toUpperCase() === 'IMG') {
+ $(this).attr("src", cdata);
+ }
+ else if(this.nodeName.toUpperCase() === "DIV"){
+ $(this).html(cdata);
+ } else {
+ $(this).text(cdata);
+ }
+ }
+ });
+
+ $("input, textarea", $parent).each(function() {
+ var name = $(this).attr("name");
+ if(!name) {
+ return;
+ }
+ that._enableTracking(this);
+
+ // ignore file inputs - they cannot be "prefilled"
+ if($(this).attr("type") == "file") {
+ return;
+ }
+
+ if(!prefix || name.indexOf(prefix + ".") >= 0) {
+ var cname = name;
+ if (prefix) {
+ cname = cname.substring(prefix.length + 1);
+ }
+
+ var cdata = that._get(data, cname, false, idx);
+
+ // check for percentage: this is value * 100
+ if ($(this).hasClass("object")) {
+ $(this).data().pojo = cdata;
+ $(this).addClass("POJO");
+ if($(this).attr("data-display") || $(this).attr("data-render")) {
+ cdata = that._renderObject(cdata, $(this).attr("data-display"), $(this).attr("data-render"));
+ }
+ } else if ($(this).hasClass("jsobject")) {
+ $(this).data().pojo = cdata;
+ $(this).addClass("POJO");
+ } else if ($(this).hasClass("percent") && !isNaN(cdata)) {
+ cdata = 100 * Number(cdata);
+ } else if($.isPlainObject(cdata)) {
+ $(this).data().pojo = cdata;
+ $(this).addClass("POJO");
+ cdata = that._renderObject(cdata, $(this).attr("data-display"), $(this).attr("data-render"));
+ }
+
+
+ if($(this).attr("type") === "checkbox") {
+ // array in checkbox
+ if($(this).hasClass("array")) {
+ // checkbox: set if any part of the array matches
+ var cbVal = $(this).val();
+ var found = false;
+ if(cdata)
+ $.each(cdata, function(){
+ if(this == cbVal) {
+ found = true;
+ return false;
+ }
+ });
+ // select
+ $(this).prop("checked", found);
+ } else
+ $(this).prop("checked", (cdata === true || cdata === "true"));
+ } else {
+ if(!cdata) {
+ cdata = "";
+ }
+
+ // format the string
+ if($.jsFormControls)
+ cdata = $.jsFormControls.Format.format(this, cdata);
+
+ // array handling
+ if($(this).hasClass("array")) {
+ // fixed numbers
+ var num = $(this).attr("data-array");
+ if(!num || isNaN(num)) {
+ num = null;
+ } else
+ num = Number(num);
+ if(num !== null && cdata && cdata.length > num) {
+ $(this).val(cdata[num]);
+ } else {
+ $(this).val("");
+ }
+ } else
+ $(this).val(cdata);
+ }
+
+ if(that.options.trackChanges)
+ $(this).data().orig = $(this).val();
+ $(this).change();
+ $(this).trigger("fill");
+ }
+ });
+
+ $("select", $parent).each(function() {
+ var name = $(this).attr("name");
+ if(!name) {
+ return;
+ }
+
+ if(!prefix || name.indexOf(prefix + ".") >= 0) {
+ var cname = name;
+ if (prefix) {
+ cname = cname.substring(prefix.length + 1);
+ }
+
+ that._enableTracking(this);
+
+ // remove "old" selected options
+ $(this).children("option:selected").prop("selected", false);
+ var pk = $(this).attr("data-key");
+ if(!pk) {
+ pk = "id";
+ }
+
+ var value = that._get(data, cname, false, idx);
+ // try selecting based on the id
+ if (value[pk] || !isNaN(value[pk])) {
+ $(this).children("option[value='"+value[pk]+"']").prop("selected", true);
+ // actually set the value and trigger the change
+ $(this).val(value[pk]).change();
+ return;
+ } else if($(this).hasClass("bool")) {
+ value = value ? "true" : "false";
+ }
+
+ $(this).children("option[value='"+value+"']").prop("selected", true);
+ $(this).val(value);
+ if(that.options.trackChanges)
+ $(this).data().orig = $(this).val();
+ $(this).change().trigger("fill");
+ }
+ });
+ };
+
+ /**
+ * ceate a pojo from a form. Takes special data definition classes into account:
+ *
+ * - number: the content will be transformed into a number (default string
+ * - trueFalse: boolean
+ *
- collection: existing collections are replaced if "class=collection" elements exist
+ *
+ * @param ignoreInvalid return a pojo, even if fields do not pass client side validation
+ * @return {Object} a new pojo
+ */
+ JsForm.prototype.get = function(ignoreInvalid) {
+ var that = this;
+ var originalPojo = this.options.data;
+ var prefix = this.options.prefix;
+
+ // get the pojo
+ var pojo = {};
+ if(originalPojo && $.isPlainObject(originalPojo)) {
+ pojo = $.extend({}, originalPojo);
+ }
+
+ // check for invalid fields
+ var invalid = false;
+
+ // go through all form parts
+ $.each(this._getForm(), function(){
+ // fill the base
+ that._createPojoFromInput(this, prefix, pojo);
+
+ if(!that.options.validateHidden) {
+ this.find(".invalid").filter(":visible").each(function(){
+ invalid = true;
+ $(this).focus();
+ if(!ignoreInvalid) {
+ that._debug("Found invalid field: " + $(this).attr("name"));
+ }
+ return false;
+ });
+ } else {
+ this.find(".invalid").each(function(){
+ invalid = true;
+ $(this).focus();
+ return false;
+ });
+ }
+
+ // get the collection
+ if(that._getCollection(this, prefix, pojo, ignoreInvalid)) {
+ invalid = true;
+ }
+ });
+
+ if(!ignoreInvalid && invalid) {
+ return null;
+ }
+
+ return pojo;
+ };
+
+ /**
+ * fill a pojo based on collections
+ * @param form {DOMElement} the base element to start looking for collections
+ * @param prefix {string} the prefix used
+ * @param pojo {object} the object to fill
+ * @param ignoreInvalid {boolean} if true the function will return as soon as an invalid field is found
+ * @return true if the colelction encountered an invalid field
+ */
+ JsForm.prototype._getCollection = function(form, prefix, pojo, ignoreInvalid) {
+ var that = this;
+ // check for invalid fields
+ var invalid = false;
+
+ form.find(".collection").each(function() {
+ if(!ignoreInvalid && invalid) {
+ return;
+ }
+
+ var fieldname = $(this).attr("data-field");
+ // only collections with the correct prefix
+ if(!fieldname || fieldname.indexOf(prefix+".") !== 0) {
+ return;
+ }
+
+ fieldname = fieldname.substring((prefix+".").length);
+
+ var colParent = that._getParent(pojo, fieldname, true);
+ // get only the last part
+ if(fieldname.indexOf('.') !== -1) {
+ fieldname = fieldname.substring(fieldname.lastIndexOf('.') + 1);
+ }
+
+ // clear the collection
+ colParent[fieldname] = [];
+
+ // go through all direct childs - each one is an element
+ $(this).children().each(function(){
+ var ele = {};
+ ele = that._createPojoFromInput($(this), fieldname, ele);
+
+ // also collect sub-collections
+ that._getCollection($(this), fieldname, ele, ignoreInvalid);
+
+ // check if the pojo is empty
+ if(!that._isEmpty(ele)) {
+ if($(".invalid", this).length > 0) {
+ invalid = true;
+ if(!ignoreInvalid)
+ return false;
+ }
+ colParent[fieldname].push(ele);
+ } else {
+ $(".invalid", this).removeClass("invalid");
+ }
+ });
+ });
+
+ return invalid;
+ };
+
+ /**
+ * Get the data object used as a base for get().
+ * Note that modifying this directly might result into unwanted results
+ * when working with some functions that rely on this object.
+ *
+ * @returns the original data object
+ */
+ JsForm.prototype.getData = function() {
+ // make srue we do have an object to work with
+ if(!this.options.data) {
+ this.options.data = {};
+ }
+ return this.options.data;
+ };
+
+ /**
+ * uses form element and replaces them with "spans" that contain the actual content.
+ * the original "inputs" are hidden
+ * @param form the form
+ * @param enable true: switch inputs with spans, false: switch spans back, undefined: toggle
+ */
+ JsForm.prototype.preventEditing = function(prevent) {
+ var $this = $(this.element);
+ var viewClass = this.options.viewClass;
+
+ if(typeof prevent === "undefined") {
+ // get the disable from the form itself
+ prevent = $this.data("disabled")?false:true;
+ } else {
+ // already in that state
+ if(prevent === $this.data("disabled")) {
+ return;
+ }
+ }
+
+ if (prevent)
+ {
+ $this.find("input, textarea").each(function() {
+ if ($(this).closest("span." + viewClass)[0])
+ return;
+ if($(this).attr("type") == "hidden")
+ return;
+ var val = $(this).val();
+ if (val === "null" || val === null || $(this).attr("type") === "submit")
+ val = "";
+ if($(this).hasClass("trueFalse")) {
+ if($(this).is(':checked'))
+ val = 'X';
+ else
+ val = ' ';
+ }
+
+ // convert \n to brs - escape all other html
+ val = val.replace(//g, ">").replace(/\n/g, "
");
+ var thespan = $(''+val+'');
+ if($(this).parent().hasClass("ui-wrapper"))
+ $(this).parent().hide().wrap(thespan);
+ else
+ $(this).hide().wrap(thespan);
+ });
+ // selects are handled slightly different
+ $this.find("select").each(function() {
+ if ($(this).closest("span."+viewClass)[0])
+ return;
+
+ var val = $(this).children(":selected").html();
+ if (val === "null" || val === null)
+ val = "";
+
+ var thespan = $(''+val+'');
+
+ // toggle switches work a little different
+ if($(this).hasClass("ui-toggle-switch")) {
+ $(this).prev().hide().wrap(thespan);
+ }
+ else {
+ $(this).hide().wrap(thespan);
+ }
+ });
+ }
+ else
+ {
+ $this.find("span." + viewClass).each(function() {
+ // remove text and then unwrap
+ var ele = $(this).children("input,select,textarea,.ui-wrapper,.ui-toggle-switch").show().detach();
+ $(this).before(ele);
+ $(this).remove();
+ });
+ }
+
+ $this.data("disabled", prevent);
+ };
+
+ /**
+ * validate a given form
+ * @return true if the form has no invalid fields, false otherwise
+ */
+ JsForm.prototype.validate = function() {
+ // get the prefix from the form if not given
+ var valid = true;
+
+ $.each(this._getForm(), function(){
+ // validation
+ $(".required,.regexp,.date,.mandatory,.number,.validate,.integer", this).change();
+ // check for invalid fields
+ if($(".invalid", this).length > 0) {
+ valid = false;
+ }
+ });
+
+ return valid;
+ };
+
+ /**
+ * fill a form based on a pojo.
+ * @param form the form
+ * @param options the options used to fill
+ * @param prefix the optional prefix used to identify fields for this form
+ * @private
+ */
+ JsForm.prototype._fill = function() {
+ var that = this;
+ $(this.element).addClass("POJO");
+ $(this.element).data("pojo", this.options.data);
+
+ // handle multiple form parts
+ $.each(this._getForm(), function(){
+ that._fillDom(this);
+ });
+ };
+
+ /**
+ * This is the actual worker function that fills a dom element
+ * with data.
+ * @param ele the element to fill
+ * @private
+ */
+ JsForm.prototype._fillDom = function(ele) {
+ var that = this;
+ that._clear(ele, that.options.prefix);
+
+ // fill base
+ that._fillData(ele, that.options.data, that.options.prefix);
+ that._fillCollection(ele, that.options.data, that.options.prefix);
+ // (re-)evaluate all conditionals
+ that._evaluateConditionals(ele, that.options.data);
+ };
+
+
+ /**
+ * @param container the container element
+ * @param data an array containing the the data
+ * @param prefix a prefix for each line of data
+ * @private
+ */
+ JsForm.prototype._fillCollection = function(container, data, prefix) {
+ var that = this;
+ // fill collections
+ $(".collection", container).each(function() {
+ var container = $(this),
+ fieldname = $(this).attr("data-field");
+ // only collections with the correct prefix
+ if(!data || !fieldname || fieldname.indexOf(prefix+".") !== 0) {
+ return;
+ }
+
+ // data for the collection filling
+ var colData = null;
+
+ var cname = fieldname;
+ // remove the prefix
+ if (prefix) {
+ cname = cname.substring(prefix.length + 1);
+ }
+ colData = that._get(data, cname);
+
+ if(colData) {
+ // fill the collection
+ that._fillList(container, colData, cname);
+ }
+ });
+ };
+
+ /**
+ * @param container the container element
+ * @param data an array containing the the data
+ * @param prefix a prefix for each line of data
+ * @param lineFunc function(line,cur) - can return false to skip the line
+ * @private
+ */
+ JsForm.prototype._fillList = function(container, data, prefix, lineFunc) {
+ var tmpl = container.data("template"),
+ that = this;
+ if(!tmpl) {
+ return;
+ }
+ // clean out previous list
+ container.empty();
+
+ // not an array
+ if(!$.isArray(data)) {
+ return;
+ }
+
+ // cut away any prefixes - only the fieldname is used
+ if(prefix.indexOf('.') !== -1) {
+ prefix = prefix.substring(prefix.lastIndexOf('.')+1);
+ }
+
+
+ // check if we need to sort the array
+ if(container.hasClass("sort")) {
+ var sortField = container.attr("data-sort");
+ if(sortField) {
+ switch(container.attr("data-sorttype")) {
+ case 'alpha':
+ data.sort();
+ break;
+ case 'alphainsensitiv':
+ data.sort(function(a,b){
+ a = a[sortField];
+ b = b[sortField];
+ if(a) a = a.toLowerCase();
+ if(b) b = b.toLowerCase();
+ if(ab)
+ return 1;
+ return 0;
+ });
+ break;
+ default:
+ data.sort(function(a,b){
+ return a[sortField] - b[sortField];
+ });
+ }
+ // descending: reverse
+ if(container.attr("data-sortdesc")) {
+ data.reverse();
+ }
+ }
+ }
+
+ if(!lineFunc) {
+ if($.isFunction(prefix)) {
+ lineFunc = prefix;
+ prefix = null;
+ }
+ }
+
+ for(var i = 0; i < data.length; i++) {
+ var cur = data[i];
+ var line = tmpl.clone(true);
+ // save current line
+ line.data().pojo = cur;
+ line.addClass("POJO");
+
+ if(lineFunc) {
+ if(lineFunc(line, cur) === false) {
+ continue;
+ }
+ }
+
+ that._addCollectionControls(line);
+
+ // trigger a callback
+ container.trigger("addCollection", [line, cur]);
+
+ if(prefix) {
+ // fill data - including the index
+ that._fillData(line, cur, prefix, i+1);
+ // enable collection controls
+ that._initCollection(line, prefix);
+ // fill with data
+ that._fillCollection(line, cur, prefix);
+ }
+ container.append(line);
+
+ // trigger a callback
+ container.trigger("postAddCollection", [line, $(line).data().pojo]);
+
+ }
+ };
+
+ /**
+ * add controls into a collection entry(i.e. delete)
+ * @param line the new collection
+ * @private
+ */
+ JsForm.prototype._addCollectionControls = function(line) {
+ var that = this;
+
+ // enable controls on the line
+ if($.jsFormControls) {
+ $(line).jsFormControls();
+ }
+
+ $(".delete", line).click(function(){
+ var ele = $(this).closest(".POJO");
+ var pojo = $(ele).data().pojo;
+ var base = $(this).closest(".collection");
+ ele.detach();
+ // trigger a callback
+ $(base).trigger("deleteCollection", [ele, pojo]);
+ });
+ $(".sortUp", line).click(function(){
+ // check if there is an up
+ var ele = $(this).closest(".POJO");
+ var prev = ele.prev(".POJO");
+ if(prev.size() === 0) {
+ // no previous element - return
+ return;
+ }
+ ele.detach();
+ prev.before(ele);
+ // reorder (if possible)
+ that._reorder(ele);
+ });
+ $(".sortDown", line).click(function(){
+ // check if there is a down
+ var ele = $(this).closest(".POJO");
+ var next = ele.next(".POJO");
+ if(next.size() === 0) {
+ // no next element - return
+ return;
+ }
+ ele.detach();
+ next.after(ele);
+ // reorder (if possible)
+ that._reorder(ele);
+ });
+
+ // if collection is sortable: refresh it
+ var container = $(line).closest(".collection");
+ if(container.hasClass("sortable")&& $(container).sortable) {
+ container.sortable("refresh");
+ }
+ };
+
+ /**
+ * Reorder a collection (actually its fields)
+ * @param ele one element of the collection or the collection itself
+ * @private
+ */
+ JsForm.prototype._reorder = function(ele) {
+ if(!ele.attr("data-sort")) {
+ ele = ele.closest(".collection");
+ }
+
+ // get the field to use for sorting
+ var sortField = $(ele).attr("data-sort");
+ if(!sortField || ($(ele).attr("data-sorttype") && $(ele).attr("data-sorttype") !== "number") ||
+ ($(ele).attr("data-sortdesc") && $(ele).attr("data-sortdesc") !== "false")) {
+ return;
+ }
+
+ // go through each child and get the pojo
+ var prio = 0;
+ $.each($(ele).children(), function(){
+ var data = $(this).data("pojo");
+ // no data yet - add one
+ if(!data) {
+ data = {};
+ $(this).data("pojo", data);
+ }
+
+ data[sortField] = prio++;
+ });
+ };
+
+ /**
+ * render an object based on a string.
+ * Note: comma is a special char and cannot be used!
+ * @param obj the object
+ * @param skin the string to render with (i.e. id, ":", test)
+ * @private
+ */
+ JsForm.prototype._renderObject = function(obj, skin, renderer) {
+ if(!obj || (!skin && !renderer))
+ return "";
+ if(renderer) {
+ if(this.options.renderer && this.options.renderer[renderer])
+ return this.options.renderer[renderer](obj);
+ this._debug("Unable to find renderer: " + renderer);
+ return "";
+ }
+
+ var that = this;
+ var ret = "";
+ $.each(skin.split(","), function(){
+ var val = this.trim();
+ if(val.indexOf("'") === 0 || val.indexOf('"') === 0) {
+ ret += val.substring(1, val.length - 1);
+ } else {
+ ret += that._get(obj, val);
+ }
+ });
+ return ret;
+ };
+
+ /**
+ * Retrieve a value from a given object by using dot-notation
+ * @param obj the object to start with
+ * @param expr the child to get (dot notation)
+ * @param create set to true and non-existant levels will be created (always returns non-null)
+ * @param idx only filles when filling collection - can be access using $idx
+ * @private
+ */
+ JsForm.prototype._get = function(obj, expr, create, idx) {
+ var ret, p, prm = "", i;
+ if(typeof expr === "function") {
+ return expr(obj);
+ }
+ if (!obj) {
+ return "";
+ }
+ // reference the object itself
+ if(expr === "")
+ return obj;
+
+ // reference to the index
+ if(expr === "$idx")
+ return idx;
+
+ ret = obj[expr];
+ if(!ret) {
+ try {
+ if(typeof expr === "string") {
+ prm = expr.split('.');
+ }
+
+ i = prm.length;
+ if(i) {
+ ret = obj;
+ while(ret && i--) {
+ p = prm.shift();
+ // create the levels
+ if(create && !ret[p]) {
+ ret[p] = {};
+ }
+ ret = ret[p];
+ }
+ }
+ } catch(e) { /* ignore */ }
+ }
+ if(ret === null || ret === undefined) {
+ ret = "";
+ }
+ // trim the return
+ if(ret.trim) {
+ return ret.trim();
+ }
+ return ret;
+ };
+
+ /**
+ * Parse a dot notation that includes arrays
+ * http://stackoverflow.com/questions/13355278/javascript-how-to-convert-json-dot-string-into-object-reference
+ * @param obj
+ * @param path a dot notation path to search for. Use format parent[1].child
+ */
+ JsForm.prototype._getValueWithArrays = function(obj, path) {
+ path = path.split('.');
+ var arrayPattern = /(.*)\[(\d+)\]/;
+ for (var i = 1; i < path.length; i++) {
+ var match = arrayPattern.exec(path[i]);
+ try {
+ if (match) {
+ obj = obj[match[1]][parseInt(match[2], 10)];
+ } else {
+ obj = obj[path[i]];
+ }
+ } catch(e) {
+ this._debug(path + " " + e);
+ }
+ }
+
+ return obj;
+ };
+
+ /**
+ * get the "parent" object of a given dot-notation. this will not return the actual
+ * element given in the dot notation but itws parent (i.e.: when using a.b.c -> it will return b)
+ * @param obj the object to start with
+ * @param the child to get (dot notation)
+ * @param create set to true and non-existant levels will be created (always returns non-null)
+ * @private
+ */
+ JsForm.prototype._getParent = function(obj, expr, create) {
+ if(expr.indexOf('.') === -1)
+ return obj;
+
+ expr = expr.substring(0, expr.lastIndexOf('.'));
+ return this._get(obj, expr, create);
+ };
+
+ /**
+ * helper function to get the number of a value
+ * @param num the string
+ * @returns a number or null
+ * @private
+ */
+ JsForm.prototype._getNumber = function(num) {
+ if (!num) {
+ return null;
+ }
+
+ // check if we have jsForm controls (internationalization)
+ if($.jsFormControls)
+ return $.jsFormControls.Format._getNumber(num);
+
+ // remove thousand seperator...
+ if(num.indexOf(",") != -1)
+ {
+ num = num.replace(new RegExp(",", 'g'), "");
+ }
+
+
+ return Number(num);
+ };
+
+ /**
+ * checks if a variable is empty. This will check array, and whole objects. If a json object
+ * only contains empty "elements" then it is considered as empty.
+ * Empty for a number is 0/-1
+ * Empty for a boolena is false
+ *
+ * @param pojo the pojo to check
+ * @returns {Boolean} true if it is empty
+ * @private
+ */
+ JsForm.prototype._isEmpty = function(pojo) {
+ // boolean false, null, undefined
+ if(!pojo) {
+ return true;
+ }
+
+ // array
+ if($.isArray(pojo)) {
+ // zero length
+ if(pojo.length === 0) {
+ return true;
+ }
+
+ // check each element
+ for(var i = 0; i < pojo.length; i++) {
+ if(!this._isEmpty()) {
+ return false;
+ }
+ }
+ return true;
+ }
+ // an object
+ if($.isPlainObject(pojo)) {
+ if($.isEmptyObject(pojo)) {
+ return true;
+ }
+
+ for(var f in pojo){
+ if(!this._isEmpty(pojo[f])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ // a number
+ if(!isNaN(pojo)) {
+ if (Number(pojo) === 0 || Number(pojo) === -1) {
+ return true;
+ }
+ return false;
+ }
+
+ // a string
+ return (pojo === "" || pojo === " ");
+ };
+
+ /**
+ * compares two objects. note: empty string or null is the same as not existant
+ * @param a the object to compare
+ * @param b the object to compare with
+ * @param idField if set then used for sub-objects instead of complete compare
+ * @return true if they contain the same content, false otherwise
+ */
+ JsForm.prototype._equals = function(a, b, idField)
+ {
+ // empty arrays
+ if(!a && b && b.length && b.length === 0) {
+ return true;
+ }
+ if(!b && a && a.length && a.length === 0) {
+ return true;
+ }
+
+ if(!a && !b) {
+ return true;
+ }
+
+ var p = null;
+ for(p in a) {
+ if(typeof(b[p]) === 'undefined' && a[p] !== null && a[p] !== "" && a[p].length !== 0) {
+ // 0 == undefined
+ if((a[p] === "0" || a[p] === 0) && !b[p])
+ continue;
+ return false;
+ }
+
+ if (a[p]) {
+ switch(typeof(a[p])) {
+ case 'object':
+ if(idField && a[p][idField]) {
+ if (a[p][idField] === b[p][idField])
+ continue;
+ }
+ // go deep
+ if (!this._equals(a[p], b[p])) {
+ return false;
+ }
+ break;
+ case 'function': // skip functions
+ break;
+ default:
+ // both are "false"
+ if(!a[p] && !b[p]) {
+ break;
+ }
+
+ if((a === true || a === false) && a !== b) {
+ return false;
+ }
+ if(!isNaN(a[p]) || !isNaN(b[p])) {
+ if(Math.abs(Number(a[p]) - Number(b[p])) < 0.0000001) {
+ break;
+ }
+ return false;
+ }
+
+ if(("" + a[p]).length !== ("" +b[p]).length) {
+ return false;
+ }
+
+ if (a[p] !== b[p] && Number(a[p]) !== Number(b[p])) {
+ return false;
+ }
+ }
+ } else {
+ if (b[p]) {
+ return false;
+ }
+ }
+ }
+
+ for(p in b) {
+ if((!a || typeof(a[p]) === 'undefined') && b[p] !== null && b[p] !== "") {
+ return false;
+ }
+ }
+
+ return true;
+ };
+
+ /**
+ * Compares a pojo with the current generated object
+ * @param pojo the pojo to compare with
+ * @return true if any change between formfields and the pojo is found
+ */
+ JsForm.prototype.equals = function(pojo, idField) {
+ var obj = this.get(false);
+ return this._equals(obj, pojo, idField);
+ };
+
+ /**
+ * Compares the current form with the last time the form was filled.
+ *
+ * @returns {Boolean} true if the form has changed since the last fill
+ */
+ JsForm.prototype.changed = function() {
+ if(!this.options.trackChanges)
+ return false;
+
+ var changed = false;
+ var that = this;
+ $.each(this._getForm(), function(){
+ if($("." + that.options.trackChanges, this).size() > 0) {
+ changed = true;
+ return false;
+ }
+ });
+
+ return changed;
+ };
+
+ /**
+ * Resets any changes and updates the dat abased on the input
+ */
+ JsForm.prototype.resetChanged = function() {
+ if(!this.options.trackChanges)
+ return false;
+
+ var changed = false;
+ var that = this;
+ $.each(this._getForm(), function(){
+ $("." + that.options.trackChanges, this).each(function(){
+ $(this).removeClass(that.options.trackChanges);
+ $(this).data().orig = $(this).val();
+ });
+ });
+
+ return changed;
+ };
+
+ JsForm.prototype._equalsCollection = function(form, prefix, pojo) {
+ var that = this;
+ var differs = false;
+
+ $(".collection", form).each(function() {
+ if(differs) {
+ return;
+ }
+
+ var fieldname = $(this).attr("data-field");
+ // only collections with the correct prefix
+ if(!fieldname || fieldname.indexOf(prefix+".") !== 0) {
+ return;
+ }
+
+ fieldname = fieldname.substring((prefix+".").length);
+ if(fieldname.length < 1) {
+ return;
+ }
+
+ var childCounter = 0;
+ // go through all direct childs - each one is an element
+ $(this).children().each(function(){
+ if(differs) {
+ return;
+ }
+
+ // check if we have more elements
+ if(childCounter >= pojo[fieldname].length) {
+ differs = true;
+ return;
+ }
+
+ var ele = pojo[fieldname][childCounter++];
+ if(that._pojoDifferFromInput($(this), fieldname, ele)) {
+ differs = true;
+ }
+
+ if(!that._equalsCollection($(this), fieldname, ele))
+ differs = true;
+ });
+
+ if(pojo[fieldname] && childCounter < pojo[fieldname].length) {
+ differs = true;
+ }
+ });
+
+ // we want to know if its equals -> return not
+ return !differs;
+ };
+
+ /**
+ * fill the form with data.
+ *
+ * - <span class="field">prefix.fieldname</span>
+ *
- <input name="prefix.fieldname"/>
+ *
- <a class="field" href="prefix.fieldname">linktest</a>
+ *
- <img class="field" src="prefix.fieldname"/>
+ *
+ * @param data {object} the data
+ */
+ JsForm.prototype.fill = function(pojo) {
+ // set the new data
+ this.options.data = $.extend({}, pojo);
+ // fill everything
+ this._fill();
+ };
+
+ /**
+ * re-evaluate the conditionals in the form based on the given data.
+ * if no data is given, the form is serialized
+ * @param data {object} the data
+ */
+ JsForm.prototype.applyConditions = function(pojo) {
+ // set the new data
+ if(!pojo)
+ pojo = this.get(true);
+
+ // evaluate everything
+ this._evaluateConditionals(this.element, pojo);
+ };
+
+ /**
+ * reset a form with the last data, overwriting any changes.
+ */
+ JsForm.prototype.reset = function() {
+ // fill with empty object
+ this.fill({});
+ };
+
+ /**
+ * Clear all fields in a form
+ */
+ JsForm.prototype.clear = function() {
+ var that = this;
+ $.each(this._getForm(), function(){
+ that._clear(this, that.options.prefix);
+ });
+ };
+
+ /**
+ * destroy the jsform and its resources.
+ * @private
+ */
+ JsForm.prototype.destroy = function( ) {
+ return $(this.element).each(function(){
+ $(this).removeData('jsForm');
+
+ if($.jsFormControls) {
+ // handle multiple form parts
+ $(this).jsFormControls("destroy");
+ }
+ });
+ };
+
+ // init and call methods
+ $.fn.jsForm = function ( method ) {
+ // Method calling logic
+ if ( typeof method === 'object' || ! method ) {
+ return this.each(function () {
+ if (!$(this).data('jsForm')) {
+ $(this).data('jsForm', new JsForm( this, method ));
+ }
+ });
+ } else {
+ var args = Array.prototype.slice.call( arguments, 1 ),
+ jsForm;
+ // none found
+ if(this.length === 0) {
+ return null;
+ }
+ // only one - return directly
+ if(this.length === 1) {
+ jsForm = $(this).data('jsForm');
+ if (jsForm) {
+ if(method.indexOf("_") !== 0 && jsForm[method]) {
+ var ret = jsForm[method].apply(jsForm, args);
+ return ret;
+ }
+
+ $.error( 'Method ' + method + ' does not exist on jQuery.jsForm' );
+ return false;
+ }
+ }
+
+ return this.each(function () {
+ jsForm = $.data(this, 'jsForm');
+ if (jsForm) {
+ if(method.indexOf("_") !== 0 && jsForm[method]) {
+ return jsForm[method].apply(jsForm, args);
+ } else {
+ $.error( 'Method ' + method + ' does not exist on jQuery.jsForm' );
+ return false;
+ }
+ }
+ });
+ }
+ };
+
+ /**
+ * global jsForm function for intialisation
+ */
+ $.jsForm = function ( name, initFunc ) {
+ var jsForms = JSFORM_MAP[name];
+ // initFunc is a function -> initialize
+ if($.isFunction(initFunc)) {
+ // call init if already initialized
+ if(jsForms) {
+ $.each(jsForms, function(){
+ initFunc(this, $(this.element));
+ });
+ }
+
+ // remember for future initializations
+ JSFORM_INIT_FUNCTIONS[name] = initFunc;
+ } else {
+ // call init if already initialized
+ if(jsForms) {
+ var method = initFunc;
+ var args = Array.prototype.slice.call( arguments, 2 );
+ $.each(portlets, function(){
+ this[method].apply(this, args);
+ });
+ }
+ }
+ };
+
+})( jQuery, window );
+
+/**
+ * jquery.jsForm.controls
+ * ----------------------
+ * UI Controls and Field validation
+ * @version 1.0
+ * @class
+ * @author Niko Berger
+ * @license MIT License GPL
+ */
+;(function( $, window, undefined ){
+ "use strict";
+
+ var JSFORM_INIT_FUNCTIONS = {}, // remember initialization functions
+ JSFORM_MAP = {}; // remember all forms
+
+ /**
+ * handlebars extension (+simple date format)
+ */
+ if(typeof Handlebars !== "undefined") {
+ Handlebars.registerHelper("currency", function(data){
+ if(!data)
+ return $.jsFormControls.Format.currency(0);
+ return $.jsFormControls.Format.currency(data);
+ });
+ Handlebars.registerHelper("dec", function(data){
+ if(!data)
+ return "";
+ return $.jsFormControls.Format.decimal(data);
+ });
+ Handlebars.registerHelper("percent", function(data){
+ if(!data)
+ return "0";
+ return $.jsFormControls.Format.decimal(data*100);
+ });
+ Handlebars.registerHelper("date", function(data){
+ if(!data)
+ return "";
+ return $.jsFormControls.Format.date(data);
+ });
+ Handlebars.registerHelper("time", function(data){
+ if(!data)
+ return "";
+ return $.jsFormControls.Format.time(data);
+ });
+ Handlebars.registerHelper("datetime", function(data){
+ if(!data)
+ return "";
+ return $.jsFormControls.Format.dateTime(data);
+ });
+ Handlebars.registerHelper("dateTime", function(data){
+ if(!data)
+ return "";
+ return $.jsFormControls.Format.dateTime(data);
+ });
+ Handlebars.registerHelper("timespan", function(data){
+ if(!data)
+ return "";
+ return $.jsFormControls.Format.humanTime(data);
+ });
+ Handlebars.registerHelper("byte", function(data){
+ if(!data)
+ return "";
+ return $.jsFormControls.Format.byte(data);
+ });
+ }
+
+ function JsFormControls(element) {
+ this.element = element;
+
+ // init the dom functionality
+ this._domInit();
+ }
+
+ /**
+ * init the dom. This can be called multiple times.
+ * this will also enable "add", "insert" and "delete" for collections
+ * @private
+ */
+ JsFormControls.prototype._domInit = function() {
+ var location = $(this.element);
+ // validation
+ // check required (this is the first check)
+ location.find("input.mandatory,textarea.mandatory").on("keyup", function(){
+ // check for "null" as value as well
+ if($(this).val().length > 0 && $(this).val() !== "null") {
+ $(this).addClass("valid").removeClass("invalid");
+ } else {
+ $(this).removeClass("valid").addClass("invalid");
+ }
+ });
+
+ location.find("input.mandatory,textarea.mandatory").on("change", function(){
+ if($(this).hasClass("object")) {
+ if($(this).data().pojo) {
+ $(this).addClass("valid").removeClass("invalid");
+ } else {
+ $(this).removeClass("valid").addClass("invalid");
+ }
+ return;
+ }
+ // check for "null" as value as well
+ if($(this).val().length > 0 && $(this).val() !== "null") {
+ $(this).addClass("valid").removeClass("invalid");
+ } else {
+ $(this).removeClass("valid").addClass("invalid");
+ }
+ }).change();
+
+ location.find("select.mandatory").change(function(){
+ // check for "null" as value as well
+ if($(this).val() !== null && $(this).val() !== "null" && $(this).val().length > 0) {
+ $(this).addClass("valid").removeClass("invalid");
+ } else {
+ $(this).removeClass("valid").addClass("invalid");
+ }
+ }).change();
+
+ // show datepicker for all inputs
+ location.find("input.date").each(function(){
+ var format = $(this).attr("data-format");
+ // only if jquery ui is available
+ if($(this).datepicker) {
+ if(format)
+ $(this).datepicker({dateFormat: format});
+ else
+ $(this).datepicker();
+ }
+ });
+
+
+ // input validation (number)
+ var numberRegexp = new RegExp("^[0-9.,-]+$");
+ location.find("input.number").keyup(function(){
+ var val = $(this).val();
+ if($(this).hasClass("currency") && val)
+ val = $.jsFormControls.Format._getNumber(val);
+ if(val.length > 0) {
+ if($(this).hasClass("autoclean")) {
+ $(this).val(val.replace(/[^0-9.,-]/g, ""));
+ }
+ else {
+ if(numberRegexp.test($(this).val())) {
+ $(this).addClass("valid").removeClass("invalid");
+ } else {
+ $(this).removeClass("valid").addClass("invalid");
+ }
+ }
+ }
+ }).keyup();
+
+ // currency formatting (add decimal)
+ location.find("input.currency").each(function(){
+ $(this).on("change blur", function(){
+ var val = $(this).val();
+ if(val.length > 0) {
+ $(this).val($.jsFormControls.Format.currency($.jsFormControls.Format._getNumber(val)));
+ }
+ });
+
+ $(this).focus(function(){
+ var val = $(this).val();
+ if(val.length > 0) {
+ $(this).val($.jsFormControls.Format._getNumber(val));
+ }
+ });
+ });
+
+ location.find("input.percent").change(function(){
+ var val = $(this).val();
+ if(val.length > 0) {
+ $(this).val($.jsFormControls.Format.decimal($.jsFormControls.Format._getNumber(val)));
+ }
+
+ $(this).focus(function(){
+ var val = $(this).val();
+ if(val.length > 0) {
+ $(this).val($.jsFormControls.Format._getNumber(val));
+ }
+ });
+ });
+
+
+ // decimal formatting (add decimal)
+ location.find("input.decimal").change(function(){
+ var val = $(this).val();
+ if(val.length > 0) {
+ $(this).val($.jsFormControls.Format.decimal($.jsFormControls.Format._getNumber(val)));
+ }
+ });
+
+ var integerRegexp = new RegExp("^[0-9]+$");
+ location.find("input.integer").keyup(function(){
+ var val = $(this).val();
+ if(val.length > 0) {
+ if($(this).hasClass("autoclean")) {
+ $(this).val(val.replace(/[^0-9]/g, ""));
+ }
+ else {
+ if(integerRegexp.test($(this).val())) {
+ $(this).addClass("valid").removeClass("invalid");
+ } else {
+ $(this).removeClass("valid").addClass("invalid");
+ }
+ }
+ }
+ }).keyup();
+
+ // regular expression
+ location.find("input.regexp").each(function(){
+ if($(this).hasClass("autoclean")) {
+ $(this).data("regexp", new RegExp($(this).attr("data-regexp"), 'g'));
+ }
+ else {
+ $(this).data("regexp", new RegExp($(this).attr("data-regexp")));
+ }
+
+ $(this).keyup(function(){
+ var val = $(this).val();
+ if(val.length > 0) {
+ var regexp = $(this).data("regexp");
+ if($(this).hasClass("autoclean")) {
+ $(this).val(val.replace(regexp, ""));
+ }
+ else {
+ if(regexp.test($(this).val())) {
+ $(this).addClass("valid").removeClass("invalid");
+ } else {
+ $(this).removeClass("valid").addClass("invalid");
+ }
+ }
+ } else {
+ // if not mandatory: nothing is valid
+ if(!$(this).hasClass("mandatory")) {
+ $(this).removeClass("invalid").addClass("valid");
+ }
+ }
+ }).keyup();
+ $(this).change(function(){
+ $(this).keyup();
+ });
+ });
+
+ /* rotatestate stontrol */
+ location.find("input.rotatestate").each(function(){
+ var states = $(this).attr("data-state-values");
+ var defaultClass = $(this).attr("data-state-class");
+ // no need to continue if there are no states
+ if(!states) {
+ return;
+ }
+
+ try {
+ states = JSON.parse(states);
+ } catch (ex) {
+ // do not need to continue if we cannot parse the states
+ return;
+ }
+
+ var stateControl = $("");
+ if($(this).attr("title")) {
+ stateControl.attr("title", $(this).attr("title"));
+ }
+ if($(this).attr("data-state-style")) {
+ stateControl.attr("style", $(this).attr("data-state-style"));
+ }
+ stateControl.data("states", states);
+ stateControl.data("control", this);
+ stateControl.data("activeState", null);
+ $(this).data("control", stateControl);
+ if(defaultClass) {
+ stateControl.addClass(defaultClass);
+ }
+
+ // click on the control starts rotating
+ stateControl.click(function(){
+ var cState = $(this).data().activeState;
+ var cStates = $(this).data().states;
+ var control = $(this).data().control;
+ var newState = null;
+
+ if(cState !== null) {
+ // go to the 'next' state
+ for(var i = 0; i < cStates.length; i++) {
+ if(cStates[i].value === cState.value) {
+ // last element
+ if(i === cStates.length - 1) {
+ newState = cStates[0];
+ } else {
+ newState = cStates[i+1];
+ }
+ break;
+ }
+ }
+ } else {
+ // no state yet - set the first entry as state
+ newState = cStates[0];
+ }
+
+ $(control).attr("value", newState.value);
+ // trigger change
+ $(control).change();
+ });
+
+ // make sure to update state if the value is changed
+ $(this).change(function(){
+ var control = $($(this).data().control);
+ var cState = control.data().activeState;
+ var cStates = control.data().states;
+
+ if(cState !== null) {
+ // remove "old state"
+ control.removeClass(cState['class']);
+ }
+
+ // add new State
+ var val = $(this).val();
+ $.each(cStates, function(){
+ if(this.value === val) {
+ control.data().activeState = this;
+ if(this.title) {
+ control.attr("title", this.title);
+ }
+ control.addClass(this['class']);
+ return false;
+ }
+ });
+ });
+
+ // trigger initial state
+ $(this).change();
+ $(this).after(stateControl);
+ $(this).hide();
+ });
+ };
+
+
+ /**
+ * validate a given form
+ * @return true if the form has no invalid fields, false otherwise
+ */
+ JsFormControls.prototype.validate = function() {
+ // validation
+ $(".required,.regexp,.date,.mandatory,.number,.validate", this.element).change();
+
+ // check for invalid fields
+ if($(".invalid", this.element).length > 0) {
+ return false;
+ }
+
+ return true;
+ };
+
+ /**
+ * destroy the jsformcontrols and its resources.
+ * @private
+ */
+ JsFormControls.prototype.destroy = function( ) {
+ return $(this.element).each(function(){
+ $(this).removeData('jsFormControls');
+ });
+ };
+
+
+ // init and call methods
+ $.fn.jsFormControls = function ( method ) {
+ // Method calling logic
+ if ( typeof method === 'object' || ! method ) {
+ return this.each(function () {
+ if (!$(this).data('jsFormControls')) {
+ $(this).data('jsFormControls', new JsFormControls( this, method ));
+ }
+ });
+ } else {
+ var args = Array.prototype.slice.call( arguments, 1 );
+
+ // only one - return directly
+ if(this.length == 1) {
+ var jsFormControls = $(this).data('jsFormControls');
+ if (jsFormControls) {
+ if(method.indexOf("_") !== 0 && jsFormControls[method]) {
+ var ret = jsFormControls[method].apply(jsFormControls, args);
+ return ret;
+ }
+
+ $.error( 'Method ' + method + ' does not exist on jQuery.jsFormControls' );
+ return false;
+ }
+ }
+
+ return this.each(function () {
+ var jsFormControls = $.data(this, 'jsFormControls');
+ if (jsFormControls) {
+ if(method.indexOf("_") !== 0 && jsFormControls[method]) {
+ return jsFormControls[method].apply(jsFormControls, args);
+ } else {
+ $.error( 'Method ' + method + ' does not exist on jQuery.jsFormControls' );
+ return false;
+ }
+ }
+ });
+ }
+ };
+
+ /**
+ * global jsForm function for intialisation
+ */
+ $.jsFormControls = function ( name, initFunc ) {
+ var jsForms;
+ // initFunc is a function -> initialize
+ if($.isFunction(initFunc)) {
+ // call init if already initialized
+ jsForms = JSFORM_MAP[name];
+ if(jsForms) {
+ $.each(jsForms, function(){
+ initFunc(this, $(this.element));
+ });
+ }
+
+ // remember for future initializations
+ JSFORM_INIT_FUNCTIONS[name] = initFunc;
+ } else {
+ // call init if already initialized
+ jsForms = JSFORM_MAP[name];
+ if(jsForms) {
+ var method = initFunc;
+ var args = Array.prototype.slice.call( arguments, 2 );
+ $.each(portlets, function(){
+ this[method].apply(this, args);
+ });
+ }
+ }
+ };
+
+ $.jsFormControls.Format = {
+ /**
+ * format a string based on teh classes in a dom element
+ */
+ format: function(ele, cdata) {
+ if($(ele).hasClass("dateTime")) {
+ if(isNaN(cdata))
+ return cdata;
+ return $.jsFormControls.Format.dateTime(cdata);
+ } if($(ele).hasClass("datetime")) {
+ if(isNaN(cdata))
+ return cdata;
+ return $.jsFormControls.Format.dateTime(cdata);
+ } else if($(ele).hasClass("date")) {
+ if(isNaN(cdata))
+ return cdata;
+ return $.jsFormControls.Format.date(cdata);
+ } else if($(ele).hasClass("currency")) {
+ return $.jsFormControls.Format.currency(cdata);
+ } else if($(ele).hasClass("byte")) {
+ if(isNaN(cdata))
+ return cdata;
+ return $.jsFormControls.Format.byte(cdata);
+ } else if($(ele).hasClass("decimal")) {
+ return $.jsFormControls.Format.decimal(cdata);
+ } else if($(ele).hasClass("percent")) {
+ return $.jsFormControls.Format.decimal(cdata);
+ }
+
+ return cdata;
+ },
+
+ /**
+ * internal function that tries to identify where the value is.
+ * This is necessary to support direct call, jqGrid and slickGrid
+ * @param row
+ * @param cell
+ * @param value
+ * @param columnDef
+ * @param dataContext
+ * @private
+ */
+ _getValue: function(row, cell, value, columnDef, dataContext) {
+ // if value is undefined: this is probably a direct call
+ if(typeof cell === "undefined" && typeof value === "undefined") {
+ return row;
+ }
+
+ // check for slickGrid: row/cell/value
+ if(!isNaN(row) && typeof cell !== "undefined" && typeof value !== "undefined") {
+ return value;
+ }
+ },
+
+ /**
+ * format boolean into an ui-icon
+ * @param value true or false
+ * @returns the ui-icon span
+ */
+ checkBox: function(row, cell, value, columnDef, dataContext) {
+ value = $.jsFormControls.Format._getValue(row, cell, value, columnDef);
+
+ if(value) {
+ return ' ';
+ } else {
+ return ' ';
+ }
+
+ return value;
+ },
+
+
+ /**
+ * take a string and convert it into a number
+ * @private
+ */
+ _getNumber: function(num) {
+ if (!num) {
+ return null;
+ }
+
+ // default number format
+ var numberformat = {
+ format: "#,##0.###",
+ groupingSeparator: ",",
+ decimalSeparator: "."
+ };
+ var pre = null, post = null;
+ if(typeof i18n !== "undefined") {
+ numberformat = i18n.number;
+ if(i18n.currency) {
+ pre = i18n.currency.prefix;
+ post = i18n.currency.suffix;
+ }
+ }
+ else if($(document).data().i18n && $(document).data().i18n.number) {
+ numberformat = $(document).data().i18n.number;
+ if($(document).data().i18n.currency) {
+ pre = $(document).data().i18n.currency.prefix;
+ post = $(document).data().i18n.currency.suffix;
+ }
+ }
+
+ // make sure num is a string
+ num = "" + num;
+
+ // check for currency pre/postfix
+ if(pre && pre.length > 0){
+ if(num.indexOf(pre) === 0)
+ num = num.substring(pre.length);
+ }
+ if(post && post.length > 0){
+ if(num.indexOf(post) > 0)
+ num = num.substring(0, num.length - post.length);
+ }
+
+ num = $.trim(num);
+ // get rid of the grouping seperator (if any exist)
+ if(num.indexOf(numberformat.groupingSeparator) !== -1)
+ num = num.replace(new RegExp("\\" +numberformat.groupingSeparator, 'g'), "");
+ // now convert the decimal seperator into a "real" decimal
+ if(numberformat.decimalSeparator !== '.' && num.indexOf(numberformat.decimalSeparator) !== -1) {
+ num = num.replace(new RegExp(numberformat.decimalSeparator, 'g'), ".");
+ }
+
+ return Number(num);
+ },
+
+
+ /**
+ * @private
+ */
+ _pad: function(val) {
+ var o = (val < 10) ? "0" : "";
+ o += val;
+ return o;
+ },
+
+ asNumber: function(value) {
+ return $.jsFormControls.Format._getNumber(value);
+ },
+
+ byte: function(bytes) {
+ if (bytes === "" || !bytes || isNaN(bytes)) {
+ return bytes;
+ }
+
+ var unit = 1024;
+ if (bytes < unit) return bytes + " B";
+ var exp = Math.floor(Math.log(bytes) / Math.log(unit));
+ var pre = "KMGTPE".charAt(exp-1) + "B";
+ return Math.round(bytes*10 / Math.pow(unit, exp))/10 + pre;
+ },
+
+ /**
+ * @private
+ */
+ decimal: function(num) {
+ if (num === "" || !num || isNaN(num)) {
+ return num;
+ }
+
+ // default number format
+ var numberformat = {
+ format: "#,##0.###",
+ groupingSeparator: ",",
+ decimalSeparator: "."
+ };
+
+ if(typeof i18n !== "undefined")
+ numberformat = i18n.number;
+ else if($(document).data().i18n && $(document).data().i18n.number)
+ numberformat = $(document).data().i18n.number;
+
+ var comma = 0;
+ if (Math.abs(num - Math.floor(num)) > 0.001) {
+ comma = 2;
+ }
+ // convert to a nice number for display
+ var n = num,
+ c = isNaN(c = Math.abs(comma)) ? 2 : comma,
+ d = numberformat.decimalSeparator, // decimal d == undefined ? "," : d,
+ t = numberformat.groupingSeparator, // thousand: t == undefined ? "." : t,
+ i = parseInt(n = Math.abs( +n || 0).toFixed(c), 10) + "",
+ j = (j = i.length) > 3 ? j % 3 : 0;
+ return (num<0 ? "-" : "") + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
+ },
+
+
+ /**
+ * @private
+ */
+ currency: function(row, cell, value, columnDef, dataContext) {
+ value = $.jsFormControls.Format._getValue(row, cell, value, columnDef);
+
+ if(!value) {
+ if(cell) {
+ return " ";
+ }
+ value = 0;
+ }
+
+ var num = $.jsFormControls.Format.decimal(value);
+ // check for currency
+ var pre = null, post = null;
+ if(typeof i18n !== "undefined") {
+ if(i18n.currency) {
+ pre = i18n.currency.prefix;
+ post = i18n.currency.suffix;
+ }
+ }
+ else if($(document).data().i18n && $(document).data().i18n.number) {
+ if($(document).data().i18n.currency) {
+ pre = $(document).data().i18n.currency.prefix;
+ post = $(document).data().i18n.currency.suffix;
+ }
+ }
+ if(pre)
+ num = pre + num;
+ if(post)
+ num = num + post;
+ return num;
+ },
+
+ /**
+ * @private
+ */
+ dateTime: function(row, cell, value, columnDef, dataContext) {
+ value = $.jsFormControls.Format._getValue(row, cell, value, columnDef);
+
+ if(!value) {
+ if(cell) {
+ return " ";
+ }
+ return "";
+ }
+
+ return (this.date(value) + " " + this.time(value));
+ },
+
+ /**
+ * @private
+ */
+ date: function(row, cell, value, columnDef, dataContext) {
+ value = $.jsFormControls.Format._getValue(row, cell, value, columnDef);
+ if(!value || value === "" || isNaN(value)) {
+ if(cell) {
+ return " ";
+ }
+ return "";
+ }
+
+ var d = new Date();
+ d.setTime(value);
+ var year = d.getYear();
+ if(year < 1900) {
+ year += 1900;
+ }
+
+ // default number format
+ var dateformat = null;
+
+ if(typeof i18n !== "undefined")
+ dateformat = i18n.date;
+ else if($(document).data().i18n && $(document).data().i18n.date)
+ dateformat = $(document).data().i18n.date;
+
+ if($.format)
+ return $.format.date(d, dateformat.shortDateFormat);
+ else
+ return this._pad(d.getDate()) + "." + this._pad((d.getMonth()+1)) + "." + this._pad(year);
+ },
+
+ /**
+ * @private
+ */
+ time: function(row, cell, value, columnDef, dataContext) {
+ value = $.jsFormControls.Format._getValue(row, cell, value, columnDef);
+ if(!value || value === "" || isNaN(value)) {
+ if(cell) {
+ return " ";
+ }
+ return "";
+ }
+
+ var d = new Date();
+ d.setTime(value);
+
+ var timeFormat = "HH:mm";
+ if(typeof i18n !== "undefined") {
+ if(i18n.timeFormat)
+ timeFormat = i18n.timeFormat;
+ else if (i18n.date && i18n.date.timeFormat)
+ timeFormat = i18n.date.timeFormat;
+ } else if($(document).data().i18n && typeof $(document).data().i18n.timeFormat !== "undefined")
+ timeFormat = $(document).data().i18n.timeFormat;
+
+ if($.format)
+ return $.format.date(d, timeFormat);
+ else
+ return this._pad(d.getHours()) + ":" + this._pad(d.getMinutes()); // + ":" + pad(d.getSeconds()); don't need seconds
+ },
+
+ /**
+ *
+ * @param value a string value to format
+ * @param allowms true to allow komma (i.e. 00.00)
+ * @return something in the form of 00:00.00
+ * @private
+ */
+ timespan: function(row, cell, value, columnDef, dataContext) {
+ value = $.jsFormControls.Format._getValue(row, cell, value, columnDef);
+
+ var tokens = value.split(":");
+ // check each token
+ for(var i=0; i 0) {
+ out += h + "h ";
+ // ignore seconds and milliseconds if we have hours
+ s = 0;
+ value = 0;
+ }
+ if (m > 0) {
+ out += m + "m ";
+ // ignore milliseconds
+ value = 0;
+ }
+ if (s > 0) {
+ out += s + "s ";
+ value = 0;
+ }
+
+ if (value > 0) {
+ out += value + "ms";
+ }
+ // trim output
+ return out.trim();
+ }
+ };
+
+})( jQuery, window );
+
+
+/**
+ * @returns the trimmed string
+ */
+String.prototype.trim = function() {
+ return this.replace(/^\s+|\s+$/g, "");
+};
+
+/* check start of a string */
+String.prototype.startsWith = function(str) {
+ if((this === null) || (this.length <= 0))
+ return false;
+ if((str === null) || (str == "null") || (str.length <= 0))
+ return false;
+ if(this.substr(0, str.length) == str)
+ return true;
+ return false;
+};
+
+/* check start of a string */
+String.prototype.startsWithIgnoreCase = function(str) {
+ if((this === null) || (this.length <= 0))
+ return false;
+ if((str === null) || (str == "null") || (str.length <= 0))
+ return false;
+ if(this.substr(0, str.length).toLowerCase() == str.toLowerCase())
+ return true;
+ return false;
+};
+
+/* check end of a string */
+String.prototype.endsWith = function(str) {
+ if((this === null) || (this.length <= 0))
+ return false;
+ if((str === null) || (str == "null") || (str.length <= 0) || (str.length > this.length))
+ return false;
+ if(this.substr(this.length - str.length) == str)
+ return true;
+ return false;
+};
\ No newline at end of file
diff --git a/dist/jquery.jsForm.1.1.3.min.js b/dist/jquery.jsForm.1.1.3.min.js
new file mode 100644
index 0000000..42fa34d
--- /dev/null
+++ b/dist/jquery.jsForm.1.1.3.min.js
@@ -0,0 +1,7 @@
+/*!
+ * jQuery.jsForm v1.1.3 | (c) 2013 Niko Berger http://www.gargan.org/
+ * Usage: https://github.com/corinis/jsForm
+ */
+(function(t,e,a){"use strict";function i(e,a){var i=t(e);this.options=t.extend({},{controls:!0,data:null,prefix:"data",trackChanges:"changed",validateHidden:!0,skipEmpty:!1,renderer:null,processors:null,connect:null,viewClass:"value"},a),!i.attr("data-prefix")||"data"!==this.options.prefix&&""!==this.options.prefix||""!==i.attr("data-prefix")&&(this.options.prefix=i.attr("data-prefix")),this.element=e,this._init()}var s={},n={};i.prototype._init=function(){if(this._domInit(),this.options.controls)if(t.jsFormControls)t.each(this._getForm(),function(){t(this).jsFormControls()});else try{"undefined"!=typeof console&&console.log("jquery.JsForm.controls not available!")}catch(e){}this._fill(this.options)},i.prototype.connect=function(e){this._initCollection(e,this.options.prefix),this._initConditional(e,this.options.prefix,this.options),this.options.controls&&t.jsFormControls&&t(e).jsFormControls(),this._fillDom(e),this.options.connect||(this.options.connect=[]),this.options.connect.push(e)},i.prototype.getNodes=function(){return this._getForm()},i.prototype._domInit=function(){var e=this;t.each(this._getForm(),function(){e._initCollection(this,e.options.prefix),e._initConditional(this,e.options.prefix,e.options)})},i.prototype._debug=function(a,i){try{if(!e.console||!e.console.log)return;var s=null;s=t.isPlainObject(i)?JSON.stringify(i,null," "):i,s||(s=""),e.console.log(a+s)}catch(n){}},i.prototype._initConditional=function(e,a,i){var s=this,n=function(e,a,i){var n=!1;t.each(i,function(){var t=s._getValueWithArrays(a,this);if(t&&""!==t&&0!==t&&-1!==t)return n=!0,!1}),n?e.show():e.hide()},r=function(e,a,i){var n=!1;t.each(i,function(){var t=s._getValueWithArrays(a,this);if(t&&""!==t&&0!==t&&-1!==t)return n=!0,!1}),n?e.hide():e.show()};this.conditionals=t(e).find(".conditional"),this.conditionals.each(function(){t(this).data().conditionalEval=[];var e=t(this).attr("data-show");e&&e.length>0&&t(this).data().conditionalEval.push({func:n,field:e.split(" ")}),e=t(this).attr("data-hide"),e&&e.length>0&&t(this).data().conditionalEval.push({func:r,field:e.split(" ")}),e=t(this).attr("data-eval"),e&&e.length>0&&i.conditionals[e]&&t(this).data().conditionalEval.push({func:i.conditionals[e]})})},i.prototype._evaluateConditionals=function(e,a){this.conditionals.each(function(){var e=t(this);t.each(e.data().conditionalEval,function(){this.func(e,a,this.field)})})},i.prototype._initCollection=function(e,a){var i={},s=this;t(e).data().collections=i,t(".collection",e).each(function(){var e=t(this).attr("data-field");if(e&&0===e.indexOf(a+".")){var n=t(this),r=i[e];if(r?r.push(n):i[e]=[n],s._initList(n),!n.hasClass("ui-sortable")&&n.hasClass("sortable")&&n.sortable){var o=n.attr("data-sortable");o=o?JSON.parse(o):{},n.sortable(o),n.on("sortstop",function(){s._reorder(n)})}}}),t(".add",e).each(function(){var e=t(this).attr("data-field");e&&(t(this).data("collections")||(t(this).data().collections=i[e],t(this).click(function(a){a.preventDefault(),t.each(t(this).data("collections"),function(){var a=t(this).data("template");if(a){var i=a.clone(!0);t(i).addClass("POJO"),t(i).data().pojo={};var n=t(this).data("prefill");n||(n=t(this).val("data-prefill")),n&&(t.isFunction(n)?n(t(i).data().pojo,t(i)):n.substring?t(i).data().pojo=JSON.parse(n):t.isPlainObject(n)&&(t(i).data().pojo=n)),t(this).append(i),s._enableTracking(t("input,textarea,select",i)),s.options.trackChanges&&t("input,textarea,select",i).addClass(s.options.trackChanges),s._addCollectionControls(i),s._initCollection(i,e.substring(e.indexOf(".")+1)),t(this).trigger("addCollection",[i,t(i).data().pojo]);var r=t(this).children(".POJO").length;s._fillData(i,t(i).data().pojo,e.substring(e.indexOf(".")+1),r),t(this).trigger("postAddCollection",[i,t(i).data().pojo])}})})))}),t(".insert",e).each(function(){var e=t(this).attr("data-field");e&&(t(this).data("collections")||(t(this).data("collections",i[t(this).attr("data-field")]),t(this).on("insert",function(a,i){if(i||(i=t(this).data().pojo),i){var n=t(this).data("beforeInsert");n&&t.isFunction(n)&&!(i=n(i))||(t.each(t(this).data("collections"),function(){var a=t(this).data("template");if(a){var n=a.clone(!0);n.addClass("POJO"),n.data().pojo=i,s._addCollectionControls(n),s._initCollection(n),t(this).trigger("addCollection",[n,i]);var r=t(this).children(".POJO").length;s._fillData(n,i,e.substring(e.indexOf(".")+1),r),t(this).append(n),t(this).trigger("postAddCollection",[n,i])}}),t(this).val(""),t(this).data().pojo=null,t(this).focus())}})))}),t(".insertAction",e).each(function(){var e=t(this).attr("data-field");if(e&&!t(this).data("inserter")){var a=t(this).parent().find(".insert");a&&(t(this).data("inserter",a),t(this).click(function(e){return e.preventDefault(),t(this).data("inserter").trigger("insert"),!1}))}}),t("input.object",e).each(function(){t(this).on("update",function(){var e=t(this).data().pojo;e&&t(this).attr("data-display")&&t(this).val(s._renderObject(e,t(this).attr("data-display")))})}),t("input.blob",e).each(function(){if("file"===t(this).attr("type")){var e=t(this);t(this).on("change",function(a){var i=t(this).val().split(/\\/).pop();e.data("name",i);var s=a.target.files;s&&s.length&&t.each(s,function(){var a=new FileReader;a.onload=function(t){e.data("blob",t.target.result)},a.readAsDataURL(this),t(this).trigger("fileChange")})})}})},i.prototype._initList=function(t){if(!t.data("template")){var e=t.children().detach();e.removeAttr("id"),t.data("template",e)}},i.prototype._getForm=function(){var e=[t(this.element)];return this.options.connect&&t.each(this.options.connect,function(){e.push(t(this))}),e},i.prototype._clear=function(e,a){a||(a=this.options.prefix),t(e).removeData("pojo"),t("input,select,textarea",e).each(function(){var e=t(this).attr("name");e&&0===e.indexOf(a+".")&&(e=e.substring((a+".").length),1>e.length||(t(this).removeData("pojo"),"checkbox"===t(this).attr("type")?t(this).prop("checked",!1):t(this).val(""),t(this).hasClass("blob")&&t(this).removeData("blob"),t(this).is("select")&&(t('option[selected="selected"]',this).prop("selected",!1),t("option:first",this).prop("selected",!0),t(this).val(t("option:first",this).val()).change()),t(this).change()))}),t(".collection",e).each(function(){var e=t(this).attr("data-field");e&&0===e.indexOf(a+".")&&t(this).empty()})},i.prototype._createPojoFromInput=function(e,i,s){var n=null,r=this;return t(e).data("pojo")&&(n=t(e).data("pojo")),n&&t.extend(!0,s,n),t(e).find("input,select,textarea,.jsobject").each(function(){var e=t(this).attr("data-name");if(e||(e=t(this).attr("name")),e&&!t(this).hasClass("transient")&&0===e.indexOf(i+".")){t(this).trigger("validate",!0),e=e.substring((i+".").length);var n=t(this).val();if(t(this).hasClass("jsobject"))n=t(this).data("pojo");else{if(r.options.skipEmpty&&(!n||""===n||""===n.trim()))return;if(!t(this).hasClass("emptynull")||n&&""!==n&&"null"!==n&&""!==n.trim())if(t(this).hasClass("object")||t(this).hasClass("POJO"))if(n=t("option:selected",this).data()&&t("option:selected",this).data().pojo?t("option:selected",this).data().pojo:t(this).data("pojo"),t.isFunction(t(this).data().processor))n=t(this).data().processor(n);else{var o=t(this).attr("data-processor");o&&r.options.processors[o]&&(n=r.options.processors[o](n))}else t(this).hasClass("blob")?n=t(this).data("blob"):""===n&&(t(this).hasClass("number")||t(this).hasClass("percent")||t(this).hasClass("integer")||t(this).hasClass("dateFilter")||t(this).hasClass("dateTimeFilter"))&&(n=null);else n=null;if(t(this).hasClass("percent"))n=r._getNumber(n),isNaN(n)?n=0:n/=100;else if(t(this).hasClass("number")||t(this).hasClass("integer")){if(t(this).hasClass("date")&&isNaN(n))if(t.format){var l=t.format.date(n);l.setHours(0),l.setMinutes(0),l.setSeconds(0),l.setMilliseconds(0),n=l.getTime()}else n=new Date(n).getTime();else n=r._getNumber(n);isNaN(n)&&(n=0)}else"checkbox"===t(this).attr("type")||"CHECKBOX"===t(this).attr("type")?n=t(this).hasClass("array")?t(this).val():t(this).is(":checked"):t(this).hasClass("bool")&&(n="true"===t(this).val())}if(1>e.length)return s=n,!1;if(-1===e.indexOf("."))if(t(this).hasClass("array"))if(s[e]||(s[e]=[]),"checkbox"===t(this).attr("type")||"CHECKBOX"===t(this).attr("type")){var h=t(this).is(":checked"),c=!0;t.each(s[e],function(t,i){return this==n?(c=!1,h||s[e].splice(i,1),!1):a}),c&&h&&s[e].push(n)}else{var d=t(this).attr("data-array");d=!d||isNaN(d)?null:Number(d),null===d?s[e].push(n):s[e][d]=n}else s[e]=n;else{var u,f,p=e.split("."),m=s[p[0]];m&&t.isPlainObject(m)||(s[p[0]]={},m=s[p[0]]),2===p.length?m[p[1]]=n:3===p.length?(u=m[p[1]],(u===a||null===u)&&(u={},m[p[1]]=u),u[p[2]]=n):4===p.length&&(u=m[p[1]],(null===u||u===a)&&(u={},m[p[1]]=u),f=u[p[2]],(f===a||null===u)&&(f={},u[p[2]]=f),u[p[2]]=n,f[p[3]]=n)}}}),s},i.prototype._enableTracking=function(e){var a=this;a.options.trackChanges&&!t(e).data().track&&(t(e).data().track=!0,t(e).change(function(){t(this).val()!==t(this).data().orig?t(this).addClass(a.options.trackChanges):t(this).removeClass(a.options.trackChanges)}))},i.prototype._fillData=function(e,i,s,n){var r=this,o=t(e);o.find(".field").each(function(){var e=t(this).data("name");if(e||("A"===this.nodeName.toUpperCase()?(e=t(this).attr("href"),t(this).attr("href","#")):"IMG"===this.nodeName.toUpperCase()?(e=t(this).attr("src"),0===e.indexOf("#")&&(e=e.substring(1)),t(this).attr("src","#")):e=t(this).text(),t(this).data("name",e),t(this).show()),!s||e.indexOf(s+".")>=0){var a=e;s&&(a=a.substring(s.length+1));var o=r._get(i,a,!1,n);o||0===o||o===!1||(o=""),t(this).hasClass("percent")&&!isNaN(o)?o=100*Number(o):t(this).hasClass("currency")&&(o||(o=0)),t.jsFormControls&&(o=t.jsFormControls.Format.format(this,o)),"A"===this.nodeName.toUpperCase()?t(this).attr("href",o):"IMG"===this.nodeName.toUpperCase()?t(this).attr("src",o):"DIV"===this.nodeName.toUpperCase()?t(this).html(o):t(this).text(o)}}),t("input, textarea",o).each(function(){var e=t(this).attr("name");if(e&&(r._enableTracking(this),"file"!=t(this).attr("type")&&(!s||e.indexOf(s+".")>=0))){var o=e;s&&(o=o.substring(s.length+1));var l=r._get(i,o,!1,n);if(t(this).hasClass("object")?(t(this).data().pojo=l,t(this).addClass("POJO"),(t(this).attr("data-display")||t(this).attr("data-render"))&&(l=r._renderObject(l,t(this).attr("data-display"),t(this).attr("data-render")))):t(this).hasClass("jsobject")?(t(this).data().pojo=l,t(this).addClass("POJO")):t(this).hasClass("percent")&&!isNaN(l)?l=100*Number(l):t.isPlainObject(l)&&(t(this).data().pojo=l,t(this).addClass("POJO"),l=r._renderObject(l,t(this).attr("data-display"),t(this).attr("data-render"))),"checkbox"===t(this).attr("type"))if(t(this).hasClass("array")){var h=t(this).val(),c=!1;l&&t.each(l,function(){return this==h?(c=!0,!1):a}),t(this).prop("checked",c)}else t(this).prop("checked",l===!0||"true"===l);else if(l||(l=""),t.jsFormControls&&(l=t.jsFormControls.Format.format(this,l)),t(this).hasClass("array")){var d=t(this).attr("data-array");d=!d||isNaN(d)?null:Number(d),null!==d&&l&&l.length>d?t(this).val(l[d]):t(this).val("")}else t(this).val(l);r.options.trackChanges&&(t(this).data().orig=t(this).val()),t(this).change(),t(this).trigger("fill")}}),t("select",o).each(function(){var e=t(this).attr("name");if(e&&(!s||e.indexOf(s+".")>=0)){var o=e;s&&(o=o.substring(s.length+1)),r._enableTracking(this),t(this).children("option:selected").prop("selected",!1);var l=t(this).attr("data-key");l||(l="id");var h=r._get(i,o,!1,n);if(h[l]||!isNaN(h[l]))return t(this).children("option[value='"+h[l]+"']").prop("selected",!0),t(this).val(h[l]).change(),a;t(this).hasClass("bool")&&(h=h?"true":"false"),t(this).children("option[value='"+h+"']").prop("selected",!0),t(this).val(h),r.options.trackChanges&&(t(this).data().orig=t(this).val()),t(this).change().trigger("fill")}})},i.prototype.get=function(e){var a=this,i=this.options.data,s=this.options.prefix,n={};i&&t.isPlainObject(i)&&(n=t.extend({},i));var r=!1;return t.each(this._getForm(),function(){a._createPojoFromInput(this,s,n),a.options.validateHidden?this.find(".invalid").each(function(){return r=!0,t(this).focus(),!1}):this.find(".invalid").filter(":visible").each(function(){return r=!0,t(this).focus(),e||a._debug("Found invalid field: "+t(this).attr("name")),!1}),a._getCollection(this,s,n,e)&&(r=!0)}),!e&&r?null:n},i.prototype._getCollection=function(e,a,i,s){var n=this,r=!1;return e.find(".collection").each(function(){if(s||!r){var e=t(this).attr("data-field");if(e&&0===e.indexOf(a+".")){e=e.substring((a+".").length);var o=n._getParent(i,e,!0);-1!==e.indexOf(".")&&(e=e.substring(e.lastIndexOf(".")+1)),o[e]=[],t(this).children().each(function(){var a={};if(a=n._createPojoFromInput(t(this),e,a),n._getCollection(t(this),e,a,s),n._isEmpty(a))t(".invalid",this).removeClass("invalid");else{if(t(".invalid",this).length>0&&(r=!0,!s))return!1;o[e].push(a)}})}}}),r},i.prototype.getData=function(){return this.options.data||(this.options.data={}),this.options.data},i.prototype.preventEditing=function(e){var i=t(this.element),s=this.options.viewClass;if(e===a)e=i.data("disabled")?!1:!0;else if(e===i.data("disabled"))return;e?(i.find("input, textarea").each(function(){if(!t(this).closest("span."+s)[0]&&"hidden"!=t(this).attr("type")){var e=t(this).val();("null"===e||null===e||"submit"===t(this).attr("type"))&&(e=""),t(this).hasClass("trueFalse")&&(e=t(this).is(":checked")?"X":" "),e=e.replace(//g,">").replace(/\n/g,"
");var a=t(''+e+"");t(this).parent().hasClass("ui-wrapper")?t(this).parent().hide().wrap(a):t(this).hide().wrap(a)}}),i.find("select").each(function(){if(!t(this).closest("span."+s)[0]){var e=t(this).children(":selected").html();("null"===e||null===e)&&(e="");var a=t(''+e+"");t(this).hasClass("ui-toggle-switch")?t(this).prev().hide().wrap(a):t(this).hide().wrap(a)}})):i.find("span."+s).each(function(){var e=t(this).children("input,select,textarea,.ui-wrapper,.ui-toggle-switch").show().detach();t(this).before(e),t(this).remove()}),i.data("disabled",e)},i.prototype.validate=function(){var e=!0;return t.each(this._getForm(),function(){t(".required,.regexp,.date,.mandatory,.number,.validate,.integer",this).change(),t(".invalid",this).length>0&&(e=!1)}),e},i.prototype._fill=function(){var e=this;t(this.element).addClass("POJO"),t(this.element).data("pojo",this.options.data),t.each(this._getForm(),function(){e._fillDom(this)})},i.prototype._fillDom=function(t){var e=this;e._clear(t,e.options.prefix),e._fillData(t,e.options.data,e.options.prefix),e._fillCollection(t,e.options.data,e.options.prefix),e._evaluateConditionals(t,e.options.data)},i.prototype._fillCollection=function(e,a,i){var s=this;t(".collection",e).each(function(){var e=t(this),n=t(this).attr("data-field");if(a&&n&&0===n.indexOf(i+".")){var r=null,o=n;i&&(o=o.substring(i.length+1)),r=s._get(a,o),r&&s._fillList(e,r,o)}})},i.prototype._fillList=function(e,a,i,s){var n=e.data("template"),r=this;if(n&&(e.empty(),t.isArray(a))){if(-1!==i.indexOf(".")&&(i=i.substring(i.lastIndexOf(".")+1)),e.hasClass("sort")){var o=e.attr("data-sort");if(o){switch(e.attr("data-sorttype")){case"alpha":a.sort();break;case"alphainsensitiv":a.sort(function(t,e){return t=t[o],e=e[o],t&&(t=t.toLowerCase()),e&&(e=e.toLowerCase()),e>t?-1:t>e?1:0});break;default:a.sort(function(t,e){return t[o]-e[o]})}e.attr("data-sortdesc")&&a.reverse()}}s||t.isFunction(i)&&(s=i,i=null);for(var l=0;a.length>l;l++){var h=a[l],c=n.clone(!0);c.data().pojo=h,c.addClass("POJO"),s&&s(c,h)===!1||(r._addCollectionControls(c),e.trigger("addCollection",[c,h]),i&&(r._fillData(c,h,i,l+1),r._initCollection(c,i),r._fillCollection(c,h,i)),e.append(c),e.trigger("postAddCollection",[c,t(c).data().pojo]))}}},i.prototype._addCollectionControls=function(e){var a=this;t.jsFormControls&&t(e).jsFormControls(),t(".delete",e).click(function(){var e=t(this).closest(".POJO"),a=t(e).data().pojo,i=t(this).closest(".collection");e.detach(),t(i).trigger("deleteCollection",[e,a])}),t(".sortUp",e).click(function(){var e=t(this).closest(".POJO"),i=e.prev(".POJO");0!==i.size()&&(e.detach(),i.before(e),a._reorder(e))}),t(".sortDown",e).click(function(){var e=t(this).closest(".POJO"),i=e.next(".POJO");0!==i.size()&&(e.detach(),i.after(e),a._reorder(e))});var i=t(e).closest(".collection");i.hasClass("sortable")&&t(i).sortable&&i.sortable("refresh")},i.prototype._reorder=function(e){e.attr("data-sort")||(e=e.closest(".collection"));var a=t(e).attr("data-sort");if(!(!a||t(e).attr("data-sorttype")&&"number"!==t(e).attr("data-sorttype")||t(e).attr("data-sortdesc")&&"false"!==t(e).attr("data-sortdesc"))){var i=0;t.each(t(e).children(),function(){var e=t(this).data("pojo");e||(e={},t(this).data("pojo",e)),e[a]=i++})}},i.prototype._renderObject=function(e,a,i){if(!e||!a&&!i)return"";if(i)return this.options.renderer&&this.options.renderer[i]?this.options.renderer[i](e):(this._debug("Unable to find renderer: "+i),"");var s=this,n="";return t.each(a.split(","),function(){var t=this.trim();n+=0===t.indexOf("'")||0===t.indexOf('"')?t.substring(1,t.length-1):s._get(e,t)}),n},i.prototype._get=function(t,e,i,s){var n,r,o,l="";if("function"==typeof e)return e(t);if(!t)return"";if(""===e)return t;if("$idx"===e)return s;if(n=t[e],!n)try{if("string"==typeof e&&(l=e.split(".")),o=l.length)for(n=t;n&&o--;)r=l.shift(),i&&!n[r]&&(n[r]={}),n=n[r]}catch(h){}return(null===n||n===a)&&(n=""),n.trim?n.trim():n},i.prototype._getValueWithArrays=function(t,e){e=e.split(".");for(var a=/(.*)\[(\d+)\]/,i=1;e.length>i;i++){var s=a.exec(e[i]);try{t=s?t[s[1]][parseInt(s[2],10)]:t[e[i]]}catch(n){this._debug(e+" "+n)}}return t},i.prototype._getParent=function(t,e,a){return-1===e.indexOf(".")?t:(e=e.substring(0,e.lastIndexOf(".")),this._get(t,e,a))},i.prototype._getNumber=function(e){return e?t.jsFormControls?t.jsFormControls.Format._getNumber(e):(-1!=e.indexOf(",")&&(e=e.replace(RegExp(",","g"),"")),Number(e)):null},i.prototype._isEmpty=function(e){if(!e)return!0;if(t.isArray(e)){if(0===e.length)return!0;for(var a=0;e.length>a;a++)if(!this._isEmpty())return!1;return!0}if(t.isPlainObject(e)){if(t.isEmptyObject(e))return!0;for(var i in e)if(!this._isEmpty(e[i]))return!1;return!0}return isNaN(e)?""===e||" "===e:0===Number(e)||-1===Number(e)?!0:!1},i.prototype._equals=function(t,e,i){if(!t&&e&&e.length&&0===e.length)return!0;if(!e&&t&&t.length&&0===t.length)return!0;if(!t&&!e)return!0;var s=null;for(s in t){if(e[s]===a&&null!==t[s]&&""!==t[s]&&0!==t[s].length){if(("0"===t[s]||0===t[s])&&!e[s])continue;return!1}if(t[s])switch(typeof t[s]){case"object":if(i&&t[s][i]&&t[s][i]===e[s][i])continue;if(!this._equals(t[s],e[s]))return!1;break;case"function":break;default:if(!t[s]&&!e[s])break;if((t===!0||t===!1)&&t!==e)return!1;if(!isNaN(t[s])||!isNaN(e[s])){if(1e-7>Math.abs(Number(t[s])-Number(e[s])))break;return!1}if((""+t[s]).length!==(""+e[s]).length)return!1;if(t[s]!==e[s]&&Number(t[s])!==Number(e[s]))return!1}else if(e[s])return!1}for(s in e)if((!t||t[s]===a)&&null!==e[s]&&""!==e[s])return!1;return!0},i.prototype.equals=function(t,e){var a=this.get(!1);return this._equals(a,t,e)},i.prototype.changed=function(){if(!this.options.trackChanges)return!1;var e=!1,i=this;return t.each(this._getForm(),function(){return t("."+i.options.trackChanges,this).size()>0?(e=!0,!1):a}),e},i.prototype.resetChanged=function(){if(!this.options.trackChanges)return!1;var e=!1,a=this;return t.each(this._getForm(),function(){t("."+a.options.trackChanges,this).each(function(){t(this).removeClass(a.options.trackChanges),t(this).data().orig=t(this).val()})}),e},i.prototype._equalsCollection=function(e,i,s){var n=this,r=!1;return t(".collection",e).each(function(){if(!r){var e=t(this).attr("data-field");if(e&&0===e.indexOf(i+".")&&(e=e.substring((i+".").length),!(1>e.length))){var o=0;t(this).children().each(function(){if(!r){if(o>=s[e].length)return r=!0,a;var i=s[e][o++];n._pojoDifferFromInput(t(this),e,i)&&(r=!0),n._equalsCollection(t(this),e,i)||(r=!0)}}),s[e]&&s[e].length>o&&(r=!0)}}}),!r},i.prototype.fill=function(e){this.options.data=t.extend({},e),this._fill()},i.prototype.applyConditions=function(t){t||(t=this.get(!0)),this._evaluateConditionals(this.element,t)},i.prototype.reset=function(){this.fill({})},i.prototype.clear=function(){var e=this;t.each(this._getForm(),function(){e._clear(this,e.options.prefix)})},i.prototype.destroy=function(){return t(this.element).each(function(){t(this).removeData("jsForm"),t.jsFormControls&&t(this).jsFormControls("destroy")})},t.fn.jsForm=function(e){if("object"!=typeof e&&e){var s,n=Array.prototype.slice.call(arguments,1);if(0===this.length)return null;if(1===this.length&&(s=t(this).data("jsForm"))){if(0!==e.indexOf("_")&&s[e]){var r=s[e].apply(s,n);return r}return t.error("Method "+e+" does not exist on jQuery.jsForm"),!1}return this.each(function(){return s=t.data(this,"jsForm"),s?0!==e.indexOf("_")&&s[e]?s[e].apply(s,n):(t.error("Method "+e+" does not exist on jQuery.jsForm"),!1):a})}return this.each(function(){t(this).data("jsForm")||t(this).data("jsForm",new i(this,e))})},t.jsForm=function(e,a){var i=n[e];if(t.isFunction(a))i&&t.each(i,function(){a(this,t(this.element))}),s[e]=a;else if(i){var r=a,o=Array.prototype.slice.call(arguments,2);t.each(portlets,function(){this[r].apply(this,o)})}}})(jQuery,window),function(t){"use strict";function e(t){this.element=t,this._domInit()}var a={},i={};"undefined"!=typeof Handlebars&&(Handlebars.registerHelper("currency",function(e){return e?t.jsFormControls.Format.currency(e):t.jsFormControls.Format.currency(0)}),Handlebars.registerHelper("dec",function(e){return e?t.jsFormControls.Format.decimal(e):""}),Handlebars.registerHelper("percent",function(e){return e?t.jsFormControls.Format.decimal(100*e):"0"}),Handlebars.registerHelper("date",function(e){return e?t.jsFormControls.Format.date(e):""}),Handlebars.registerHelper("time",function(e){return e?t.jsFormControls.Format.time(e):""}),Handlebars.registerHelper("datetime",function(e){return e?t.jsFormControls.Format.dateTime(e):""}),Handlebars.registerHelper("dateTime",function(e){return e?t.jsFormControls.Format.dateTime(e):""}),Handlebars.registerHelper("timespan",function(e){return e?t.jsFormControls.Format.humanTime(e):""}),Handlebars.registerHelper("byte",function(e){return e?t.jsFormControls.Format.byte(e):""})),e.prototype._domInit=function(){var e=t(this.element);e.find("input.mandatory,textarea.mandatory").on("keyup",function(){t(this).val().length>0&&"null"!==t(this).val()?t(this).addClass("valid").removeClass("invalid"):t(this).removeClass("valid").addClass("invalid")}),e.find("input.mandatory,textarea.mandatory").on("change",function(){return t(this).hasClass("object")?(t(this).data().pojo?t(this).addClass("valid").removeClass("invalid"):t(this).removeClass("valid").addClass("invalid"),undefined):(t(this).val().length>0&&"null"!==t(this).val()?t(this).addClass("valid").removeClass("invalid"):t(this).removeClass("valid").addClass("invalid"),undefined)}).change(),e.find("select.mandatory").change(function(){null!==t(this).val()&&"null"!==t(this).val()&&t(this).val().length>0?t(this).addClass("valid").removeClass("invalid"):t(this).removeClass("valid").addClass("invalid")}).change(),e.find("input.date").each(function(){var e=t(this).attr("data-format");t(this).datepicker&&(e?t(this).datepicker({dateFormat:e}):t(this).datepicker())});var a=RegExp("^[0-9.,-]+$");e.find("input.number").keyup(function(){var e=t(this).val();t(this).hasClass("currency")&&e&&(e=t.jsFormControls.Format._getNumber(e)),e.length>0&&(t(this).hasClass("autoclean")?t(this).val(e.replace(/[^0-9.,-]/g,"")):a.test(t(this).val())?t(this).addClass("valid").removeClass("invalid"):t(this).removeClass("valid").addClass("invalid"))}).keyup(),e.find("input.currency").each(function(){t(this).on("change blur",function(){var e=t(this).val();e.length>0&&t(this).val(t.jsFormControls.Format.currency(t.jsFormControls.Format._getNumber(e)))}),t(this).focus(function(){var e=t(this).val();e.length>0&&t(this).val(t.jsFormControls.Format._getNumber(e))})}),e.find("input.percent").change(function(){var e=t(this).val();e.length>0&&t(this).val(t.jsFormControls.Format.decimal(t.jsFormControls.Format._getNumber(e))),t(this).focus(function(){var e=t(this).val();e.length>0&&t(this).val(t.jsFormControls.Format._getNumber(e))})}),e.find("input.decimal").change(function(){var e=t(this).val();e.length>0&&t(this).val(t.jsFormControls.Format.decimal(t.jsFormControls.Format._getNumber(e)))});var i=RegExp("^[0-9]+$");e.find("input.integer").keyup(function(){var e=t(this).val();e.length>0&&(t(this).hasClass("autoclean")?t(this).val(e.replace(/[^0-9]/g,"")):i.test(t(this).val())?t(this).addClass("valid").removeClass("invalid"):t(this).removeClass("valid").addClass("invalid"))}).keyup(),e.find("input.regexp").each(function(){t(this).hasClass("autoclean")?t(this).data("regexp",RegExp(t(this).attr("data-regexp"),"g")):t(this).data("regexp",RegExp(t(this).attr("data-regexp"))),t(this).keyup(function(){var e=t(this).val();if(e.length>0){var a=t(this).data("regexp");t(this).hasClass("autoclean")?t(this).val(e.replace(a,"")):a.test(t(this).val())?t(this).addClass("valid").removeClass("invalid"):t(this).removeClass("valid").addClass("invalid")}else t(this).hasClass("mandatory")||t(this).removeClass("invalid").addClass("valid")}).keyup(),t(this).change(function(){t(this).keyup()})}),e.find("input.rotatestate").each(function(){var e=t(this).attr("data-state-values"),a=t(this).attr("data-state-class");if(e){try{e=JSON.parse(e)}catch(i){return}var s=t("");t(this).attr("title")&&s.attr("title",t(this).attr("title")),t(this).attr("data-state-style")&&s.attr("style",t(this).attr("data-state-style")),s.data("states",e),s.data("control",this),s.data("activeState",null),t(this).data("control",s),a&&s.addClass(a),s.click(function(){var e=t(this).data().activeState,a=t(this).data().states,i=t(this).data().control,s=null;if(null!==e){for(var n=0;a.length>n;n++)if(a[n].value===e.value){s=n===a.length-1?a[0]:a[n+1];break}}else s=a[0];t(i).attr("value",s.value),t(i).change()}),t(this).change(function(){var e=t(t(this).data().control),a=e.data().activeState,i=e.data().states;null!==a&&e.removeClass(a["class"]);var s=t(this).val();t.each(i,function(){return this.value===s?(e.data().activeState=this,this.title&&e.attr("title",this.title),e.addClass(this["class"]),!1):undefined})}),t(this).change(),t(this).after(s),t(this).hide()}})},e.prototype.validate=function(){return t(".required,.regexp,.date,.mandatory,.number,.validate",this.element).change(),t(".invalid",this.element).length>0?!1:!0},e.prototype.destroy=function(){return t(this.element).each(function(){t(this).removeData("jsFormControls")})},t.fn.jsFormControls=function(a){if("object"!=typeof a&&a){var i=Array.prototype.slice.call(arguments,1);if(1==this.length){var s=t(this).data("jsFormControls");if(s){if(0!==a.indexOf("_")&&s[a]){var n=s[a].apply(s,i);return n}return t.error("Method "+a+" does not exist on jQuery.jsFormControls"),!1}}return this.each(function(){var e=t.data(this,"jsFormControls");return e?0!==a.indexOf("_")&&e[a]?e[a].apply(e,i):(t.error("Method "+a+" does not exist on jQuery.jsFormControls"),!1):undefined})}return this.each(function(){t(this).data("jsFormControls")||t(this).data("jsFormControls",new e(this,a))})},t.jsFormControls=function(e,s){var n;if(t.isFunction(s))n=i[e],n&&t.each(n,function(){s(this,t(this.element))}),a[e]=s;else if(n=i[e]){var r=s,o=Array.prototype.slice.call(arguments,2);t.each(portlets,function(){this[r].apply(this,o)})}},t.jsFormControls.Format={format:function(e,a){return t(e).hasClass("dateTime")?isNaN(a)?a:t.jsFormControls.Format.dateTime(a):t(e).hasClass("datetime")?isNaN(a)?a:t.jsFormControls.Format.dateTime(a):t(e).hasClass("date")?isNaN(a)?a:t.jsFormControls.Format.date(a):t(e).hasClass("currency")?t.jsFormControls.Format.currency(a):t(e).hasClass("byte")?isNaN(a)?a:t.jsFormControls.Format.byte(a):t(e).hasClass("decimal")?t.jsFormControls.Format.decimal(a):t(e).hasClass("percent")?t.jsFormControls.Format.decimal(a):a},_getValue:function(t,e,a){return e===undefined&&a===undefined?t:isNaN(t)||e===undefined||a===undefined?undefined:a},checkBox:function(e,a,i,s){return i=t.jsFormControls.Format._getValue(e,a,i,s),i?' ':' '},_getNumber:function(e){if(!e)return null;var a={format:"#,##0.###",groupingSeparator:",",decimalSeparator:"."},i=null,s=null;return"undefined"!=typeof i18n?(a=i18n.number,i18n.currency&&(i=i18n.currency.prefix,s=i18n.currency.suffix)):t(document).data().i18n&&t(document).data().i18n.number&&(a=t(document).data().i18n.number,t(document).data().i18n.currency&&(i=t(document).data().i18n.currency.prefix,s=t(document).data().i18n.currency.suffix)),e=""+e,i&&i.length>0&&0===e.indexOf(i)&&(e=e.substring(i.length)),s&&s.length>0&&e.indexOf(s)>0&&(e=e.substring(0,e.length-s.length)),e=t.trim(e),-1!==e.indexOf(a.groupingSeparator)&&(e=e.replace(RegExp("\\"+a.groupingSeparator,"g"),"")),"."!==a.decimalSeparator&&-1!==e.indexOf(a.decimalSeparator)&&(e=e.replace(RegExp(a.decimalSeparator,"g"),".")),Number(e)},_pad:function(t){var e=10>t?"0":"";return e+=t},asNumber:function(e){return t.jsFormControls.Format._getNumber(e)},"byte":function(t){if(""===t||!t||isNaN(t))return t;var e=1024;if(e>t)return t+" B";var a=Math.floor(Math.log(t)/Math.log(e)),i="KMGTPE".charAt(a-1)+"B";return Math.round(10*t/Math.pow(e,a))/10+i},decimal:function(e){if(""===e||!e||isNaN(e))return e;var a={format:"#,##0.###",groupingSeparator:",",decimalSeparator:"."};"undefined"!=typeof i18n?a=i18n.number:t(document).data().i18n&&t(document).data().i18n.number&&(a=t(document).data().i18n.number);var i=0;Math.abs(e-Math.floor(e))>.001&&(i=2);var s=e,n=isNaN(n=Math.abs(i))?2:i,r=a.decimalSeparator,o=a.groupingSeparator,l=parseInt(s=Math.abs(+s||0).toFixed(n),10)+"",h=(h=l.length)>3?h%3:0;return(0>e?"-":"")+(h?l.substr(0,h)+o:"")+l.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+o)+(n?r+Math.abs(s-l).toFixed(n).slice(2):"")},currency:function(e,a,i,s){if(i=t.jsFormControls.Format._getValue(e,a,i,s),!i){if(a)return" ";i=0}var n=t.jsFormControls.Format.decimal(i),r=null,o=null;return"undefined"!=typeof i18n?i18n.currency&&(r=i18n.currency.prefix,o=i18n.currency.suffix):t(document).data().i18n&&t(document).data().i18n.number&&t(document).data().i18n.currency&&(r=t(document).data().i18n.currency.prefix,o=t(document).data().i18n.currency.suffix),r&&(n=r+n),o&&(n+=o),n},dateTime:function(e,a,i,s){return i=t.jsFormControls.Format._getValue(e,a,i,s),i?this.date(i)+" "+this.time(i):a?" ":""},date:function(e,a,i,s){if(i=t.jsFormControls.Format._getValue(e,a,i,s),!i||""===i||isNaN(i))return a?" ":"";var n=new Date;n.setTime(i);var r=n.getYear();1900>r&&(r+=1900);var o=null;return"undefined"!=typeof i18n?o=i18n.date:t(document).data().i18n&&t(document).data().i18n.date&&(o=t(document).data().i18n.date),t.format?t.format.date(n,o.shortDateFormat):this._pad(n.getDate())+"."+this._pad(n.getMonth()+1)+"."+this._pad(r)},time:function(e,a,i,s){if(i=t.jsFormControls.Format._getValue(e,a,i,s),!i||""===i||isNaN(i))return a?" ":"";var n=new Date;n.setTime(i);var r="HH:mm";return"undefined"!=typeof i18n?i18n.timeFormat?r=i18n.timeFormat:i18n.date&&i18n.date.timeFormat&&(r=i18n.date.timeFormat):t(document).data().i18n&&t(document).data().i18n.timeFormat!==undefined&&(r=t(document).data().i18n.timeFormat),t.format?t.format.date(n,r):this._pad(n.getHours())+":"+this._pad(n.getMinutes())},timespan:function(e,a,i,s){i=t.jsFormControls.Format._getValue(e,a,i,s);for(var n=i.split(":"),r=0;n.length>r;r++){var o=Number(n[r]);o&&"NaN"!==o||(o=0),n[r]=this._pad(o)}return 0>=n.length?"0:00":1==n.length?"0:"+this._pad(allowkomma?n[0]:Math.floor(n[0])):2==n.length?allowkomma?n[0]:Math.floor(n[0])+":"+this._pad(allowkomma?n[1]:Math.floor(n[1])):allowkomma?n[0]:Math.floor(n[0])+":"+this._pad(allowkomma?n[1]:Math.floor(n[1]))+":"+pad(allowkomma?n[2]:Math.floor(n[2]))},humanTime:function(e,a,i,s){if(i=t.jsFormControls.Format._getValue(e,a,i,s),isNaN(i))return i&&0!==i.length?i:"-";
+var n=Math.floor(i/36e5);i-=36e5*n;var r=Math.floor(i/6e4);i-=6e4*r;var o=Math.floor(i/1e3);i-=1e3*o;var l="";return n>0&&(l+=n+"h ",o=0,i=0),r>0&&(l+=r+"m ",i=0),o>0&&(l+=o+"s ",i=0),i>0&&(l+=i+"ms"),l.trim()}}}(jQuery,window),String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")},String.prototype.startsWith=function(t){return null===this||0>=this.length?!1:null===t||"null"==t||0>=t.length?!1:this.substr(0,t.length)==t?!0:!1},String.prototype.startsWithIgnoreCase=function(t){return null===this||0>=this.length?!1:null===t||"null"==t||0>=t.length?!1:this.substr(0,t.length).toLowerCase()==t.toLowerCase()?!0:!1},String.prototype.endsWith=function(t){return null===this||0>=this.length?!1:null===t||"null"==t||0>=t.length||t.length>this.length?!1:this.substr(this.length-t.length)==t?!0:!1};
+//@ sourceMappingURL=dist/jquery.jsForm.min.map
\ No newline at end of file
diff --git a/dist/jquery.jsForm.min.map b/dist/jquery.jsForm.min.map
index d616986..a90a9ea 100644
--- a/dist/jquery.jsForm.min.map
+++ b/dist/jquery.jsForm.min.map
@@ -1 +1 @@
-{"version":3,"file":"dist/jquery.jsForm.1.1.2.min.js","sources":["dist/jquery.jsForm-1.1.2.js"],"names":["$","window","undefined","JsForm","element","options","$this","this","extend","controls","data","prefix","trackChanges","validateHidden","skipEmpty","renderer","processors","connect","attr","_init","JSFORM_INIT_FUNCTIONS","JSFORM_MAP","prototype","_domInit","jsFormControls","each","_getForm","console","log","ex","_fill","ele","_initCollection","_initConditional","_fillDom","push","getNodes","that","_debug","msg","param","p","isPlainObject","JSON","stringify","form","showEvaluator","fields","show","value","_getValueWithArrays","hide","hideEvaluator","conditionals","find","conditionalEval","length","func","field","split","_evaluateConditionals","collectionMap","collections","colName","indexOf","container","cols","_initList","hasClass","sortable","config","parse","on","_reorder","fieldName","click","ev","preventDefault","tmpl","line","clone","addClass","pojo","append","_enableTracking","_addCollectionControls","trigger","substring","beforeInsertCallback","isFunction","idx","children","_fillData","val","focus","inserter","parent","_renderObject","blobInput","evt","fileName","pop","files","target","reader","FileReader","onload","e","result","readAsDataURL","detach","removeAttr","_clear","removeData","name","prop","is","change","fieldname","empty","_createPojoFromInput","start","startObj","trim","processor","_getNumber","isNaN","format","d","date","setHours","setMinutes","setSeconds","setMilliseconds","getTime","Date","use","pushVal","index","splice","num","Number","d1","d2","parts","d0","track","orig","removeClass","$parent","nodeName","toUpperCase","text","cname","cdata","_get","Format","html","cbVal","found","pk","get","ignoreInvalid","originalPojo","invalid","filter","_getCollection","colParent","_getParent","lastIndexOf","_isEmpty","getData","preventEditing","prevent","closest","replace","thespan","wrap","prev","before","remove","validate","valid","_fillCollection","colData","_fillList","lineFunc","isArray","sortField","sort","a","b","toLowerCase","reverse","i","cur","size","next","after","prio","obj","skin","ret","expr","create","prm","shift","path","arrayPattern","match","exec","parseInt","isEmptyObject","f","_equals","idField","Math","abs","equals","changed","_equalsCollection","differs","childCounter","_pojoDifferFromInput","fill","applyConditions","reset","clear","destroy","unbind","fn","jsForm","method","args","Array","slice","call","arguments","apply","error","initFunc","jsForms","portlets","jQuery","JsFormControls","Handlebars","registerHelper","currency","decimal","time","dateTime","humanTime","byte","location","datepicker","dateFormat","numberRegexp","RegExp","keyup","test","integerRegexp","regexp","states","defaultClass","stateControl","cState","activeState","cStates","control","newState","title","_getValue","row","cell","checkBox","columnDef","numberformat","groupingSeparator","decimalSeparator","i18n","number","document","_pad","o","asNumber","bytes","unit","exp","floor","pre","charAt","round","pow","comma","n","c","t","toFixed","j","substr","setTime","year","getYear","dateformat","shortDateFormat","getDate","getMonth","timeFormat","getHours","getMinutes","timespan","tokens","nt","allowkomma","pad","h","m","s","out","String","startsWith","str","startsWithIgnoreCase","endsWith"],"mappings":"CASC,SAAWA,EAAGC,EAAQC,GACtB,YAWA,SAASC,GAAQC,EAASC,GACzB,GAAIC,GAAQN,EAAEI,EAGdG,MAAKF,QAAUL,EAAEQ,WAIhBC,UAAU,EAIVC,KAAM,KAINC,OAAQ,OAMRC,aAAc,UAKdC,gBAAgB,EAIhBC,WAAW,EAKXC,SAAU,KAKVC,WAAY,KAKZC,QAAS,MACPZ,IAGAC,EAAMY,KAAK,gBAA2C,SAAxBX,KAAKF,QAAQM,QAA6C,KAAxBJ,KAAKF,QAAQM,QAC9C,KAA9BL,EAAMY,KAAK,iBACbX,KAAKF,QAAQM,OAASL,EAAMY,KAAK,gBAInCX,KAAKH,QAAUA,EAEfG,KAAKY,QAnEN,GAAIC,MACJC,IAyEAlB,GAAOmB,UAAUH,MAAQ,WAKxB,GAHAZ,KAAKgB,WAGFhB,KAAKF,QAAQI,SACf,GAAGT,EAAEwB,eAEJxB,EAAEyB,KAAKlB,KAAKmB,WAAY,WACvB1B,EAAEO,MAAMiB,uBAGT,KACuB,mBAAZG,UACTA,QAAQC,IAAI,yCAEZ,MAAMC,IAOVtB,KAAKuB,MAAMvB,KAAKF,UAOjBF,EAAOmB,UAAUL,QAAU,SAASc,GAEnCxB,KAAKyB,gBAAgBD,EAAKxB,KAAKF,QAAQM,QAEvCJ,KAA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,IAAIC,GAAM,EAqBV,OApBIH,GAAI,IACPG,GAAOH,EAAI,KAEXE,EAAI,EACJ5Q,EAAQ,GAEL2Q,EAAI,IACPE,GAAOF,EAAI,KAEX3Q,EAAQ,GAEL4Q,EAAI,IACPC,GAAOD,EAAI,KACX5Q,EAAQ,GAGLA,EAAQ,IACX6Q,GAAO7Q,EAAQ,MAGT6Q,EAAInM,UAIXwH,OAAQlP,QAMZ8T,OAAOzS,UAAUqG,KAAO,WACvB,MAAOpH,MAAKwK,QAAQ,aAAc,KAInCgJ,OAAOzS,UAAU0S,WAAa,SAASC,GACtC,MAAa,QAAT1T,MAAkC,GAAfA,KAAKiD,QACpB,EACI,OAARyQ,GAAyB,QAAPA,GAAiC,GAAdA,EAAIzQ,QACrC,EACLjD,KAAKoS,OAAO,EAAGsB,EAAIzQ,SAAWyQ,GACzB,GACD,GAIRF,OAAOzS,UAAU4S,qBAAuB,SAASD,GAChD,MAAa,QAAT1T,MAAkC,GAAfA,KAAKiD,QACpB,EACI,OAARyQ,GAAyB,QAAPA,GAAiC,GAAdA,EAAIzQ,QACrC,EACLjD,KAAKoS,OAAO,EAAGsB,EAAIzQ,QAAQwI,eAAiBiI,EAAIjI,eAC3C,GACD,GAIR+H,OAAOzS,UAAU6S,SAAW,SAASF,GACpC,MAAa,QAAT1T,MAAkC,GAAfA,KAAKiD,QACpB,EACI,OAARyQ,GAAyB,QAAPA,GAAiC,GAAdA,EAAIzQ,QAAiByQ,EAAIzQ,OAASjD,KAAKiD,QACxE,EACLjD,KAAKoS,OAAOpS,KAAKiD,OAASyQ,EAAIzQ,SAAWyQ,GACpC,GACD"}
\ No newline at end of file
+{"version":3,"file":"dist/jquery.jsForm.1.1.3.min.js","sources":["dist/jquery.jsForm-1.1.3.js"],"names":["$","window","undefined","JsForm","element","options","$this","this","extend","controls","data","prefix","trackChanges","validateHidden","skipEmpty","renderer","processors","connect","viewClass","attr","_init","JSFORM_INIT_FUNCTIONS","JSFORM_MAP","prototype","_domInit","jsFormControls","each","_getForm","console","log","ex","_fill","ele","_initCollection","_initConditional","_fillDom","push","getNodes","that","_debug","msg","param","p","isPlainObject","JSON","stringify","form","showEvaluator","fields","show","value","_getValueWithArrays","hide","hideEvaluator","conditionals","find","conditionalEval","length","func","field","split","_evaluateConditionals","collectionMap","collections","colName","indexOf","container","cols","_initList","hasClass","sortable","config","parse","on","_reorder","fieldName","click","ev","preventDefault","tmpl","line","clone","addClass","pojo","prefill","val","isFunction","substring","append","_enableTracking","_addCollectionControls","trigger","idx","children","_fillData","beforeInsertCallback","focus","inserter","parent","_renderObject","blobInput","evt","fileName","pop","files","target","reader","FileReader","onload","e","result","readAsDataURL","detach","removeAttr","_clear","removeData","name","prop","is","change","fieldname","empty","_createPojoFromInput","start","startObj","trim","processor","_getNumber","isNaN","format","d","date","setHours","setMinutes","setSeconds","setMilliseconds","getTime","Date","use","pushVal","index","splice","num","Number","d1","d2","parts","d0","track","orig","removeClass","$parent","nodeName","toUpperCase","text","cname","cdata","_get","Format","html","cbVal","found","pk","get","ignoreInvalid","originalPojo","invalid","filter","_getCollection","colParent","_getParent","lastIndexOf","_isEmpty","getData","preventEditing","prevent","closest","replace","thespan","wrap","prev","before","remove","validate","valid","_fillCollection","colData","_fillList","lineFunc","isArray","sortField","sort","a","b","toLowerCase","reverse","i","cur","base","size","next","after","prio","obj","skin","ret","expr","create","prm","shift","path","arrayPattern","match","exec","parseInt","RegExp","isEmptyObject","f","_equals","idField","Math","abs","equals","changed","resetChanged","_equalsCollection","differs","childCounter","_pojoDifferFromInput","fill","applyConditions","reset","clear","destroy","fn","jsForm","method","args","Array","slice","call","arguments","apply","error","initFunc","jsForms","portlets","jQuery","JsFormControls","Handlebars","registerHelper","currency","decimal","time","dateTime","humanTime","byte","location","datepicker","dateFormat","numberRegexp","keyup","test","integerRegexp","regexp","states","defaultClass","stateControl","cState","activeState","cStates","control","newState","title","_getValue","row","cell","checkBox","columnDef","numberformat","groupingSeparator","decimalSeparator","pre","post","i18n","number","suffix","document","_pad","o","asNumber","bytes","unit","exp","floor","charAt","round","pow","comma","n","c","t","toFixed","j","substr","setTime","year","getYear","dateformat","shortDateFormat","getDate","getMonth","timeFormat","getHours","getMinutes","timespan","tokens","nt","allowkomma","pad","h","m","s","out","String","startsWith","str","startsWithIgnoreCase","endsWith"],"mappings":"CASC,SAAWA,EAAGC,EAAQC,GACtB,YAWA,SAASC,GAAQC,EAASC,GACzB,GAAIC,GAAQN,EAAEI,EAGdG,MAAKF,QAAUL,EAAEQ,WAIhBC,UAAU,EAIVC,KAAM,KAINC,OAAQ,OAMRC,aAAc,UAKdC,gBAAgB,EAIhBC,WAAW,EAKXC,SAAU,KAKVC,WAAY,KAKZC,QAAS,KAKTC,UAAW,SACTb,IAGAC,EAAMa,KAAK,gBAA2C,SAAxBZ,KAAKF,QAAQM,QAA6C,KAAxBJ,KAAKF,QAAQM,QAC9C,KAA9BL,EAAMa,KAAK,iBACbZ,KAAKF,QAAQM,OAASL,EAAMa,KAAK,gBAInCZ,KAAKH,QAAUA,EAEfG,KAAKa,QAxEN,GAAIC,MACJC,IA8EAnB,GAAOoB,UAAUH,MAAQ,WAKxB,GAHAb,KAAKiB,WAGFjB,KAAKF,QAAQI,SACf,GAAGT,EAAEyB,eAEJzB,EAAE0B,KAAKnB,KAAKoB,WAAY,WACvB3B,EAAEO,MAAMkB,uBAGT,KACuB,mBAAZG,UACTA,QAAQC,IAAI,yCAEZ,MAAMC,IAOVvB,KAAKwB,MAAMxB,KAAKF,UAOjBF,EAAOoB,UAAUN,QAAU,SAASe,GAEnCzB,KAAK0B,gBAAgBD,EAAKzB,KAAKF,QAAQM,QAEvCJ,KAAK2B,iBAAiBF,EAAKzB,KAAKF,QAAQM,OAAQJ,KAAKF,SAGlDE,KAAKF,QAAQI,UACZT,EAAEyB,gBAEJzB,EAAEgC,GAAKP,iBAITlB,KAAK4B,SAASH,GACVzB,KAAKF,QAAQY,UAChBV,KAAKF,QAAQY,YACdV,KAAKF,QAAQY,QAAQ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
--- a/src/jquery.jsForm.controls.js
+++ b/src/jquery.jsForm.controls.js
@@ -539,7 +539,7 @@
// check for currency pre/postfix
if(pre && pre.length > 0){
- if(num.indexOf(pre) == 0)
+ if(num.indexOf(pre) === 0)
num = num.substring(pre.length);
}
if(post && post.length > 0){