diff --git a/src/FormulateInputGroup.vue b/src/FormulateInputGroup.vue index d25f41f..b23f282 100644 --- a/src/FormulateInputGroup.vue +++ b/src/FormulateInputGroup.vue @@ -54,7 +54,9 @@ export default { methods: { groupItemContext (context, option, groupAttributes) { const optionAttributes = {} - const ctx = Object.assign({}, context, option, groupAttributes, optionAttributes) + const ctx = Object.assign({}, context, option, groupAttributes, optionAttributes, !context.hasGivenName ? { + name: true + } : {}) return ctx } } diff --git a/src/libs/context.js b/src/libs/context.js index 53dc32d..3aec415 100644 --- a/src/libs/context.js +++ b/src/libs/context.js @@ -164,17 +164,7 @@ function nameOrFallback () { * determine if an input has a user-defined name */ function hasGivenName () { - if ( - this.name && - typeof this.name === 'string' && - this.name !== `${this.type}_${this.id}` && - this.name !== `${this.type}_${this.defaultId}` && - // radio and checkbox options have their value as part of their ID so we need to filter those out too - this.name !== `${this.type}_${(String(this.id).replace('_' + String(this.value), ''))}` - ) { - return true - } - return false + return typeof this.name !== 'boolean' } /**