Only validate that the free entries are email addresses on calendarowner, not every value

This commit is contained in:
nathan 2022-07-15 13:31:15 -06:00
parent 9ebc1e8f15
commit 3e83c5bb1c

View File

@ -38,9 +38,6 @@ export class CalendarOwner extends Et2Select
super(...args);
this.searchUrl = "calendar_owner_etemplate_widget::ajax_search";
this.multiple = true;
// Any free entries must be email addresses
this.defaultValidators.push(new IsEmail());
}
/**
@ -91,6 +88,22 @@ export class CalendarOwner extends Et2Select
}, this, true, this).sendRequest();
}
}
/**
* Check if a free entry value is acceptable.
* We only check the free entry, since value can be mixed.
*
* @param text
* @returns {boolean}
*/
public validateFreeEntry(text) : boolean
{
let validators = [...this.validators, new IsEmail()];
let result = validators.filter(v =>
v.execute(text, v.param, {node: this}),
);
return result.length == 0;
}
}
customElements.define("calendar-owner", CalendarOwner);