Posted: 24 Feb 2017 12:44 EST Last activity: 26 Feb 2017 22:48 EST
Enforced Auto Completes
Has anyone developed a reusable control that enforces auto complete selection? My problem scenario is below.
The auto complete is sourced by D_CompanyDetails, allows searching by ID, City, or Name, and sets the .SelectedCompanyID property to the value of .CompanyID.
CompanyID City Name
1234 Chicago Pizza Hut
5678 Detroit Little Ceasars
My problem is that nothing out of box enforces that a valid value is selected. For example, I could type in 9999 and tab off and my .SelectedCompanyID property would have an invalid value (9999 does not exist). Likewise, I could type in "Pizza Hut" and if I did not specifically arrow down and click enter on the "Pizza Hut" option, it would not set my .SelectedCompanyID to "1234". It would have the invalid value of "Pizza Hut".
I am able to create a when rule/activity that checks that my .SelectedCompanyID exists in the D_CompanyDetails data page, and force the user to select a valid value, however the problem with this is that the solution only works for this one scenario. The next time that I need to use an auto complete for something else, I have to create another activity/when rule to handle the validation.
Ideally a control would exist that does this for free. I'm only currently worried about data page sourced auto completes, however in the perfect world, the solution would also validate against the other sourcing options as well.
If the data set was small, I could enforce this with a dropdown. For a data set with thousands of records, this is not feasible.
Just a pointer, it is better to write a more generalized activity or function which takes the input property value and DataPage name and which returns if the value exists or not. Call this rule whereever you want this validation to happen. Also hope some OOTB function for the same already exists. Not able to recall.
Hi Jerome, you hit all the key points here. If client side enforcement is absolutely needed then a dropdown would be best. But this doesn't scale well if you have a lot of potentially valid options.
So you naturally gravitated toward an autocomplete, but then you lose out on the validation. The appropriate solution here is you need to add your own post processing validation, which isn't ideal but it does work. The problem here is it is not generic, and you'd like a control to do this all for you.
The current implementation of the autocomplete is more of a predictive text field where you can and should be allowed to deviate from the suggested results. They are as implied, just suggestions.
But I hear you. And I've heard this request many times in the past to create a "smart" for enforced autocomplete. We not have one of those today OOTB, so you are correct in seeking the greater community to see if someone has come up with such a custom control.
Assuming no one has, and you're interested in submitting an enhancement request to be considered in a future release the moderators can help you spin one of those here.
Do let us know if you wish to file an enhancement to the product. We can create an enhancement request for you, on our internal portal, but you would need to take further actions on it by working with your Pega Account Executive.