Added a formatValue function

This commit is contained in:
2019-10-08 17:31:30 +02:00
parent 914bfa8a83
commit e9a0dfe68e
3 changed files with 11 additions and 5 deletions

View File

@ -33,9 +33,9 @@ export default class FMDatalistInput extends FMInput {
getValue(): string {
if (this.datalist) {
let option: HTMLOptionElement = this.datalist.querySelector(`[value="${this.element.value}"]`)
if (option) return option.dataset.value
if (option) return this.formatValue(option.dataset.value)
}
return this.isStrict ? undefined : this.element.value
return this.isStrict ? undefined : this.formatValue(this.element.value)
}
}