vue-formular
Advanced tools
Comparing version 0.0.35 to 0.1.0
12
index.js
@@ -12,2 +12,7 @@ String.prototype.ucfirst = require('./lib/helpers/ucfirst'); | ||
props: { | ||
ajax: { | ||
type: Boolean, | ||
required: false, | ||
default: false | ||
}, | ||
action: { | ||
@@ -65,2 +70,8 @@ type: String, | ||
if (!this.ajax) { | ||
var payload = this.options.additionalPayload; | ||
for (key in payload) { | ||
this.additionalValues.push({name:key,value:payload[key]}); | ||
} | ||
} | ||
@@ -72,2 +83,3 @@ }, | ||
dirtyFields:[], | ||
additionalValues:[], | ||
errors:[], | ||
@@ -74,0 +86,0 @@ serverErrors:[], |
module.exports = function() { | ||
return !this.rules.requiredIf || !!this.errors.length; | ||
} |
@@ -34,5 +34,6 @@ var render_template = require('../../helpers/render-template'); | ||
return this.multiple?"checkbox":"radio"; | ||
} | ||
}, | ||
arraySymbol: require('../computed/array-symbol') | ||
} | ||
} | ||
@@ -82,2 +82,11 @@ var render_template = require('../../helpers/render-template'); | ||
}, | ||
serverFormat: function() { | ||
if (!this.value) return ''; | ||
if (!this.range) return this.value.format(); | ||
return JSON.stringify({start:this.value.start.format(), | ||
end:this.value.end.format() | ||
}); | ||
} | ||
@@ -84,0 +93,0 @@ }, |
@@ -61,4 +61,7 @@ var render_template = require('../../helpers/render-template'); | ||
}, | ||
computed: { | ||
arraySymbol: require('../computed/array-symbol') | ||
}, | ||
mixins:[props,data, methods, computed,ready], | ||
} | ||
@@ -1,10 +0,19 @@ | ||
module.exports = function() { | ||
module.exports = function(e) { | ||
if (this.ajax) | ||
e.preventDefault(); | ||
if (this.errors.length>0) { | ||
this.showAllErrors(); | ||
e.preventDefault(); | ||
return false; | ||
} | ||
if (this.pristine) return false; | ||
if (this.pristine) { | ||
e.preventDefault(); | ||
return false; | ||
} | ||
if (!this.ajax) return; | ||
var data = this.formData(); | ||
@@ -11,0 +20,0 @@ |
{ | ||
"name": "vue-formular", | ||
"description": "a comprehensive vue.js form component", | ||
"version": "0.0.35", | ||
"version": "0.1.0", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "vue", |
@@ -5,4 +5,4 @@ # Vue Formular | ||
This vue.js package offers a comperhensive solution for HTML form management, including presentation, validation and submitting the form using an AJAX request. | ||
The payload sent to the server will include only changed ("dirty") fields, thus saving redundant data iteration and manipulation on the server side. | ||
This vue.js package offers a comperhensive solution for HTML form management, including presentation, validation and (optional) AJAX submission. | ||
When using AJAX, The payload sent to the server will include only changed ("dirty") fields, thus saving redundant data iteration and manipulation on the server side. | ||
The presentation is based on [Bootstrap's form component](http://getbootstrap.com/css/#forms). | ||
@@ -58,2 +58,4 @@ | ||
Important: to send the form using an AJAX request, add the `ajax` property to `vf-form`. | ||
## Fields | ||
@@ -204,3 +206,3 @@ | ||
### Server-side validation | ||
### Server-side validation (when using AJAX to send the form) | ||
@@ -213,11 +215,11 @@ Sometimes you might want to do some extra validation on the server side, after the form is sent (i.e no client-side validation errors). | ||
`vue-formular.sending` | ||
`vue-formular.sending` (ajax form) | ||
Fires off when the form is being sent. Sends through the form data. A message will automatically appear in the status bar. | ||
`vue-formular.sent` | ||
`vue-formular.sent` (ajax form) | ||
Fires off after the form has been sent successfully. Sends through the form data. The status bar will show the response returned from the server, if it is a string, or else the designtaed text. | ||
`vue-formular.invalid` | ||
`vue-formular.invalid` (ajax form) | ||
@@ -224,0 +226,0 @@ Fires off after the form returned an invalid response from the server. Sends through the response |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44361
68
926
253