Skip to content

Commit edf033d

Browse files
committed
Merge branch 'devel' of github.com:Meteor-Community-Packages/meteor-autoform into migration/meteor-3.0
2 parents 47bfac2 + 4a50425 commit edf033d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

autoform-events.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,11 @@ Template.autoForm.events({
450450
return
451451
}
452452

453-
const formId = event.target.closest('form').id
454-
if (formId !== this.id) return
453+
const parentForm = event.target.form ?? event.target.closest('form')
454+
const formId = parentForm.getAttribute('id')
455+
const expectedId = this.id
456+
457+
if (formId !== expectedId) return
455458

456459
// Some plugins, like jquery.inputmask, can cause infinite
457460
// loops by continually saying the field changed when it did not,

autoform-helpers.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,13 @@ Template.registerHelper('afFieldValueContains', autoFormFieldValueContains)
216216
* @return {Object}
217217
*/
218218
export const autoFormFieldLabelText = function autoFormFieldLabelText (options) {
219+
// in some cases we want to define labels als hidden under the autoform ctx
220+
// but remain visible in the overall schema ctx (so their name is shown
221+
// during validation) which causes label / atts.label to be false
222+
const self = this
223+
if ([null, false].includes(self?.label ?? self?.atts?.label)) {
224+
return null
225+
}
219226
options = parseOptions(options, 'afFieldLabelText', true)
220227
return AutoForm.getLabelForField(options.name)
221228
}

0 commit comments

Comments
 (0)