2
Views
5
Comments
Input_AutoComplete_GetIdentifier returning typed value
Question
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 ?

Regards
2012-03-16 12-21-09
João Rosado
Staff
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.

Regards,
João Rosado
2014-11-18 22-34-13
kota
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. 

Regards
2014-11-18 22-34-13
kota
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 ?
2014-11-18 22-34-13
kota
I think I have found the problem, if user doesn't tab out of the input box, it doesn't work.
2014-11-18 22-34-13
kota
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.
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.