Skip to content

Commit 829ad02

Browse files
committed
Expose attributes so that we can use the id to distinguish different inputs with the same field name
1 parent b5042c0 commit 829ad02

File tree

8 files changed

+20
-6
lines changed

8 files changed

+20
-6
lines changed

dist/formulate.esm.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/formulate.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/formulate.umd.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@braid/vue-formulate",
3-
"version": "2.5.3",
3+
"version": "2.5.3-mast-fork",
44
"description": "The easiest way to build forms in Vue.",
55
"main": "dist/formulate.umd.js",
66
"module": "dist/formulate.esm.js",
@@ -27,7 +27,7 @@
2727
},
2828
"repository": {
2929
"type": "git",
30-
"url": "git+ssh://git@github.com/wearebraid/vue-formulate.git"
30+
"url": "git+ssh://git@github.com/usemast/vue-formulate.git"
3131
},
3232
"keywords": [
3333
"vue",

src/FormulateForm.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export default {
197197
}
198198
},
199199
created () {
200+
console.log('Using the Mast fork of vue-formulate')
200201
this.$formulate.register(this)
201202
this.applyInitialValues()
202203
this.$emit('created', this)

src/FormulateInput.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ export default {
582582
getErrorObject () {
583583
return {
584584
name: this.context.nameOrFallback || this.context.name,
585+
attributes: this.context.attributes, // Expose attributes so that we can use the id to distinguish different inputs with the same field name
585586
errors: this.validationErrors.filter(s => typeof s === 'string'),
586587
hasErrors: !!this.validationErrors.length
587588
}

test/unit/FormulateForm.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,10 @@ describe('FormulateForm', () => {
582582
const errorObject = errorObjects[2][0]
583583
expect(errorObject).toEqual({
584584
name: 'testinput',
585+
attributes: {
586+
id: "formulate-global-48",
587+
name: "testinput",
588+
},
585589
errors: [
586590
expect.any(String)
587591
],
@@ -605,6 +609,10 @@ describe('FormulateForm', () => {
605609
const errorObject = errorObjects[2][0]
606610
expect(errorObject).toEqual({
607611
name: 'testinput',
612+
attributes: {
613+
id: "formulate-global-50",
614+
name: "testinput",
615+
},
608616
errors: [],
609617
hasErrors: false
610618
})

test/unit/FormulateInput.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ describe('FormulateInput', () => {
217217
const errorObject = wrapper.emitted('validation')[0][0]
218218
expect(errorObject).toEqual({
219219
name: 'testinput',
220+
attributes: {
221+
id: "formulate-global-16",
222+
name: "testinput",
223+
},
220224
errors: [
221225
expect.any(String)
222226
],

0 commit comments

Comments
 (0)