Input_AutoComplete_GetIdentifier returning typed value

Input_AutoComplete_GetIdentifier returning typed value

I have a autocomplete based on the static entity and while trying to save the record, I and checking to see if user have selected a valid value by performing (Input_AutoComplete_GetIdentifier.Identifier = -1 ) check. For some weird reason, it returns whatever is typed in the text field. What am I doing wrong ?

Hi Kota,

One of the parameters of that method is the "previous value". What is happening is that you are setting that parameter to the same variable of the input.

The correct way to use it is to either pass as argument the id it had in the preparation of the screen. That way you will be able to distinguish the 3 possible situations: the user did not change the input, the user changed the input to a valid value or the user changed it to an invalid value.
If your input is always empty at the beginning of the screen, then just pass -1 to it.

João Rosado
Thanks Joao, That was exactly the issue. I knew there was something wrong with previous value but couldn't figure it out. Actually in this screen the identifier and the label are the same and input was always empty in the beginning of the screen,  so that was creating the problem. After setting it to -1 , it is working correctly. 

Joao, I have a related question.
If user select a valid value from an auto-complete and then manually type in some other value that is not in the auto-complete list, and hit save , it retain the value that user selected from the screen and does not return -1 as identifier.

I am using value bound to recordedit as previous value.

What could be causing it ?
I think I have found the problem, if user doesn't tab out of the input box, it doesn't work.
Are we supposed to set the previous value from preparation screen record or from the record edit screen ? I couldn't find any documentation for it. Although that shouldn't matter in most cases IMO.