Auto-Complete control validaiton update for pega 8.7

Pega out of the box control Auto-Complete gives you the ability to type in few characters and based on the characters it gives you back the results based on the Source provided which can be Data page, RD etc.

Auto-Complete as a control does not validate the value selected or typed in manually is valid according to the source list of values. How can I validate the autocomplete if not select any value from dropdown list.

But right now I applied the same as Sushanth Kommera said earlier post.

See the post . But in Pega 8.7 it’s not working for me.

So, overcome this issue I found one solution. And it’s work perfectly for me.

  1. Add OOTB ‘lodash’ JS and ‘AutoCompleteValidation’ (attached) files to your harness.— You can download the file from previous post. Click Here

  2. In autocomplete control, go to presentation tab and include ‘autocomplete-validate’ in ‘Cell read-write classes’.

  3. Add on change action & call the “setupAutoCompleteValidation” function

@MalayD02 ,

We are on 8.7 and it working without on change function for us.

@BATTINIRAMESH Ok.

For me it’s not working properly . On load & after refresh it’s not working for me. So I applied the on change function.

After that it’s working properly.

@MalayD02 Hi Could you please share setupAutoCompleteValidation function. I do not see one with me. Thank you in advance.

Hi All, update for Pega 24 as few changes for the approach described here Auto-Complete control validaiton | Support Center (pega.com) were required in order to make it work.

  1. In the post referenced above there are two javascript files to be attached to the Harness: Lodash and Autocomplete. As Lodash library is already included in Pega 8.8 there is no need to add javascript file instance, just the existing one needs to be referenced in the Harness:

  1. Also, LoadAutocompleteValidation,js script had to be adjusted as the function for adding validate error mentioned in the previous post looks to be not there any more. The updated version is attached, it’s adding error in Pega valiation error style but not using any Pega API as I coulnd’t find any suitable.

  1. In order to enable it only autocomplete-validate style had to be added to Cell read-write classes in the control:

LoadAutocomplete.txt (3.96 KB)

@KishoreR7037 Please check the description on top . you can find the details from there.

@Oleg ShepelevThanks a lot for your step by step guide and the updated LoadAutocomplete.txt. However, I still do not see any error message below my autocomplete field. Any ideas what could be the issue for that?
I also get this (!) in my code in line 54 (see screenshot).