How to populate other input text after selecting autocomplete suggestion?

How to populate other input text after selecting autocomplete suggestion?

  

Currently I have 3 input text namely, A, B and C.

Field A is the input with autocomplete widget that only take in Integer.

eg: Integer 1234 will be decoded to Text "Suggestion 1"


I would like to populate the autocomplete suggestions in Field B upon selecting the one of the suggestions. At the same time, I want to retain what I entered in Field A.

Eg:

I entered integer 1234 in Field A. 

Autocomplete widget will show suggestions in text - "Suggestion 1" and ""Suggestion 2"

When I select "Suggestion 1" Field A will still show 1234 and Field B will populate "Suggestion 1".


Something similar to the jquery autocomplete select event in the following. Upon selection, I can execute other things while retaining the value my input.

http://jsfiddle.net/krustev/yqshb/

Hi Ace,

Me and Marcelo already answer this a few minutes ago in another post (that does not exists any more)...

You have an onchange property in the input widget. Add there an action. In the action do the ajax refresh of the named element that you want.

Cheers,

José

José Costa wrote:

Hi Ace,

Me and Marcelo already answer this a few minutes ago in another post (that does not exists any more)...

You have an onchange property in the input widget. Add there an action. In the action do the ajax refresh of the named element that you want.

Cheers,

José


Hi,

When I select the autocomplete suggestion, the text of the suggestion will still overwrite what I typed in. I still wish to retain my own input in Field A. How do I do it?


Hi,

Why do you want to select something on A autocomplete but the resultt goes to B instead of A? Whats the requirement for that?

Regards,

Marcelo

Hi Ace,

To do what you want your best bet is to add the plugin that you want (in your case the kendoui) to your app. Check this post:

https://www.outsystems.com/forums/discussion/9727/how-to-integrate-a-jquery-plugin-in-the-outsystems-platform/

Cheers,

José

Marcelo Ferreira wrote:

Hi,

Why do you want to select something on A autocomplete but the resultt goes to B instead of A? Whats the requirement for that?

Regards,

Marcelo

Hi,

The autocomplete widget for field A will only appear when the integer enter mapped to more than one suggestions.  So the autocomplete will allow user to choose the desired mapping. (eg. number 4 mapped to suggstions 4 and 5)

In fact most of the time is one to one mapping so no autocomplete will be shown and I can populate Field B straight. 

=D

Database:

AB
1suggestion 1
2suggestion 2
3suggestion 3
4suggestion 4
4suggestion 5
5suggestion 6



hi Ace, 

to create the auto complete, follow this link: https://www.outsystems.com/forums/discussion/11834/autocomplete-boxes/, with some changes for the new version using aggregate and mapping, instead of sql:


and to keep the input A with the integer value1, 2, 3, 4, just set the A value with the integer, not the text:

 and as suggested by the thread above, use data refresh to the input widget A and input widget B, and also data refresh to B, where B is a combo box, to the change action on the widget A:

The aggregate for the the GetSuggestionPrep is in the Preparation action, with filter:

where v_number is local variable for widget A.

Here is the output in my espace:

regards, 

bb

Barong Bali wrote:

hi Ace, 

to create the auto complete, follow this link: https://www.outsystems.com/forums/discussion/11834/autocomplete-boxes/, with some changes for the new version using aggregate and mapping, instead of sql:


and to keep the input A with the integer value1, 2, 3, 4, just set the A value with the integer, not the text:

 and as suggested by the thread above, use data refresh to the input widget A and input widget B, and also data refresh to B, where B is a combo box, to the change action on the widget A:

The aggregate for the the GetSuggestionPrep is in the Preparation action, with filter:

where v_number is local variable for widget A.

Here is the output in my espace:

regards, 

bb


Hi,

Is is possible to attach your oml? It seems like it is not my desired behavior. 


What i want is...


Type in field A. Select suggestion 5.


Populate selection's text in field B. (autocomplete selection show under field A but autocomplete field B)

Hi Ace,

Please have a look at the oml(attached).

Sachin

Sachin Mahawar wrote:

Hi Ace,

Please have a look at the oml(attached).

Sachin

Hi Sachin,


Thank you so much for your help =). However the behavior is not what i want. Var 2 should not be assigned with Var 1. Var 2 should be assigned with the autocomplete selection. 


Ace wrote:

Sachin Mahawar wrote:

Hi Ace,

Please have a look at the oml(attached).

Sachin

Hi Sachin,


Thank you so much for your help =). However the behavior is not what i want. Var 2 should not be assigned with Var 1. Var 2 should be assigned with the autocomplete selection. 




Hi Ace,

Let me also give it a try. :)

In attach goes the oml. What I did was adding this piece of javascript to an expression on the page:

"<script>
$(function() {
  $('#" + Person.Id + "').attr(""onchange"", ""$('#" + InputValue2.Id + "').val($(this).val()); $('#" + Button.Id + "').click()"" );
});
</script>"

What it does is adding an onchange event to the input (Person.Id). When it changes, it gets the value into an input widget (InputValue2.Id) and then clicks on a button (Button.Id)  to submit getting that value and putting into a local variable.

Is this what you want?

By the way, it works if you click on the selected value. If you use the keys it does not work and solving that goes beyond my knowledge/available time.

Cheers,

José

Thank you everyone for the help! However none is the behavior I wanted. Currently I am looking at other form of displaying.


Great week ahead! =D