Foren

AutoCompleteList validation

Robert Meissner, geändert vor 7 Jahren.

AutoCompleteList validation

Junior Member Beiträge: 76 Beitrittsdatum: 26.02.15 Neueste Beiträge
Hello,

i have a <aui:input type="text"> with an AutoCompleteList on it. Additionally, i want to have a Validator, that triggers after "select" on the AutoCompleteList ist triggered, and not onBlur of the textfield. Anyone ever solved this?
thumbnail
Kiran Yalavali, geändert vor 7 Jahren.

RE: AutoCompleteList validation

Regular Member Beiträge: 175 Beitrittsdatum: 15.10.14 Neueste Beiträge
Hi Robert,

Could you explain completely, i will help you robert.

Thanks,
kiran.
Robert Meissner, geändert vor 7 Jahren.

RE: AutoCompleteList validation

Junior Member Beiträge: 76 Beitrittsdatum: 26.02.15 Neueste Beiträge
Thanks for your willingness. The problem with my validator is that it triggers on blur, i.e. on select of the AutoCompleteList, but at this time, my textfield contains an invalid value. This means, that i cannot use the standard validator on my textfield but have to use a custom validator, that triggers on select of the AutoCompleteList. But then i have one validator missing, i.e.: what if the user enters a value without using the AutoCompleteList?
thumbnail
Kyle Joseph Stiemann, geändert vor 7 Jahren.

RE: AutoCompleteList validation

Liferay Master Beiträge: 760 Beitrittsdatum: 14.01.13 Neueste Beiträge
Hi Robert,
You could trigger the input's blur event on the AutoCompleteList's select event:

new Y.AutoCompleteList({
/* ... your code here ... */
after: {
select: function(event) {
this.get("inputNode").simulate("blur"); // or you could fire the validation event here
}
}
});


If that doesn't work, you could fire whatever validation event you need to fire on the select event instead of firing the blur event. I'm not an expert on validation, so I'm not sure what that event would be.

- Kyle
Robert Meissner, geändert vor 7 Jahren.

RE: AutoCompleteList validation

Junior Member Beiträge: 76 Beitrittsdatum: 26.02.15 Neueste Beiträge
Thanks for your effort, i will check this on occasion.