Form element add data-item feature..
This commit is contained in:
parent
548210d613
commit
2e3e033677
64
resources/assets/js/plugins/form.js
vendored
64
resources/assets/js/plugins/form.js
vendored
@ -88,6 +88,38 @@ export default class Form {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (form_element.getAttribute('data-item')) {
|
||||||
|
if (!this['items']) {
|
||||||
|
var item = {};
|
||||||
|
var row = {};
|
||||||
|
|
||||||
|
item[0] = row;
|
||||||
|
this['items'] = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this['items'][0][form_element.getAttribute('data-item')]) {
|
||||||
|
this['items'][0][form_element.getAttribute('data-item')] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
this['item_backup'] = this['items'];
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (form_element.getAttribute('data-field')) {
|
||||||
|
if (!this[form_element.getAttribute('data-field')]) {
|
||||||
|
var field = {};
|
||||||
|
|
||||||
|
this[form_element.getAttribute('data-field')] = field;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this[form_element.getAttribute('data-field')][name]) {
|
||||||
|
this[form_element.getAttribute('data-field')][name] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (this[name]) {
|
if (this[name]) {
|
||||||
if (!this[name].push) {
|
if (!this[name].push) {
|
||||||
this[name] = [this[name]];
|
this[name] = [this[name]];
|
||||||
@ -106,6 +138,38 @@ export default class Form {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (form_element.getAttribute('data-item')) {
|
||||||
|
if (!this['items']) {
|
||||||
|
var item = {};
|
||||||
|
var row = {};
|
||||||
|
|
||||||
|
item[0] = row;
|
||||||
|
this['items'] = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this['items'][0][form_element.getAttribute('data-item')]) {
|
||||||
|
this['items'][0][form_element.getAttribute('data-item')] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
this['item_backup'] = this['items'];
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (form_element.getAttribute('data-field')) {
|
||||||
|
if (!this[form_element.getAttribute('data-field')]) {
|
||||||
|
var field = {};
|
||||||
|
|
||||||
|
this[form_element.getAttribute('data-field')] = field;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this[form_element.getAttribute('data-field')][name]) {
|
||||||
|
this[form_element.getAttribute('data-field')][name] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (this[name]) {
|
if (this[name]) {
|
||||||
if (!this[name].push) {
|
if (!this[name].push) {
|
||||||
this[name] = [this[name]];
|
this[name] = [this[name]];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user