Skip to content

Commit eaa01e7

Browse files
committed
general form with validation error
1 parent 7ca1070 commit eaa01e7

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

test/test-data.js

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ export default {
373373
methods: {
374374
validationError(modelField) {
375375
if (this.errors == null) return false;
376-
return this.errors.find(function (el) {
376+
return this.errors.details.find(function (el) {
377377
return el.path === modelField
378378
})
379379
}
@@ -761,7 +761,7 @@ export default {
761761
methods: {
762762
validationError(modelField) {
763763
if (this.errors == null) return false;
764-
return this.errors.find(function (el) {
764+
return this.errors.details.find(function (el) {
765765
return el.path === modelField
766766
})
767767
}
@@ -1152,7 +1152,7 @@ module.exports.BookForm = `
11521152
:searchUrl = "this.$baseUrl()"
11531153
v-model:foreignKey="book.publisherId"
11541154
label="name"
1155-
valueKey="id"
1155+
valueKey="id"
11561156
targetModel="Publisher"
11571157
v-bind:initialInput="publisherInitialLabel">
11581158
</foreign-key-form-element>
@@ -1170,8 +1170,8 @@ module.exports.BookForm = `
11701170
:mode="mode"
11711171
:addItems.sync="book.addPeople"
11721172
label="firstName"
1173-
subLabel ="email"
1174-
valueKey="id"
1173+
subLabel ="email"
1174+
valueKey="id"
11751175
model="Book"
11761176
targetModel = "Person"
11771177
removeName="removePeople"
@@ -1203,18 +1203,18 @@ import axios from 'axios'
12031203
export default {
12041204
props: [ 'book', 'errors', 'mode' ],
12051205
data(){
1206-
return{
1207-
target_models: [
1208-
{
1209-
model:'Person',
1210-
label: 'firstName',
1211-
sublabel: 'email'
1212-
} ],
1213-
model: 'book'
1206+
return{
1207+
target_models: [
1208+
{
1209+
model:'Person',
1210+
label: 'firstName',
1211+
sublabel: 'email'
1212+
} ],
1213+
model: 'book'
12141214
}
12151215
},
12161216
computed: {
1217-
publisherInitialLabel: function () {
1217+
publisherInitialLabel: function () {
12181218
var x = this.book.publisher
12191219
if (x !== null && typeof x === 'object' &&
12201220
x['name'] !== null &&
@@ -1224,13 +1224,14 @@ export default {
12241224
return ''
12251225
}
12261226
}
1227-
},
1227+
1228+
},
12281229
methods: {
12291230
validationError(modelField) {
12301231
if (this.errors == null) return false;
1231-
return this.errors.find(function (el) {
1232-
return el.path === modelField
1233-
})
1232+
return this.errors.details.find(function (el) {
1233+
return el.path === modelField
1234+
})
12341235
}
12351236
},
12361237
mounted: function() {
@@ -1243,6 +1244,7 @@ export default {
12431244
})
12441245
},
12451246
created(){
1247+
12461248
}
12471249
}
12481250
</script>
@@ -1641,7 +1643,7 @@ export default {
16411643
methods: {
16421644
validationError(modelField) {
16431645
if (this.errors == null) return false;
1644-
return this.errors.find(function (el) {
1646+
return this.errors.details.find(function (el) {
16451647
return el.path === modelField
16461648
})
16471649
}
@@ -1770,7 +1772,7 @@ export default {
17701772
methods: {
17711773
validationError(modelField) {
17721774
if (this.errors == null) return false;
1773-
return this.errors.find(function (el) {
1775+
return this.errors.details.find(function (el) {
17741776
return el.path === modelField
17751777
})
17761778
}
@@ -2212,7 +2214,7 @@ export default {
22122214
methods: {
22132215
validationError(modelField) {
22142216
if (this.errors == null) return false;
2215-
return this.errors.find(function (el) {
2217+
return this.errors.details.find(function (el) {
22162218
return el.path === modelField
22172219
})
22182220
}

test/test-features.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ describe('VueTable GraphQl Query', function(){
8787
});
8888

8989
let modelsObjBook = funks.fillOptionsForViews(models.book) ;
90-
it('BookFormElemns - hasMany',async function(){
90+
it('BookFormElemns - hasMany - validation error',async function(){
9191
let file = await funks.renderTemplate('formElements',modelsObjBook);
9292
let created_formElement = file.replace(/\s/g, '');
9393
let test_formElement = testData.BookForm.replace(/\s/g, '');

views/pages/formElements.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export default {
131131
methods: {
132132
validationError(modelField) {
133133
if (this.errors == null) return false;
134-
return this.errors.find(function (el) {
134+
return this.errors.details.find(function (el) {
135135
return el.path === modelField
136136
})
137137
}

0 commit comments

Comments
 (0)