Home » Alloy UI » English

Combination View Flat View Tree View
Threads [ Previous | Next ]
Andrej Litowka
Keydown event
November 14, 2012 2:45 AM

Andrej Litowka

Rank: Junior Member

Posts: 79

Join Date: June 30, 2010

Recent Posts

Hi All!

I have following code

 3<aui:input name="Field 1" id="val1"></aui:input>
 4<aui:input name="Field 2" id="val2"></aui:input>
 5<aui:input name="Result" id="val3"></aui:input>
 8<aui:script use="aui-base, node">
 9var v = A.on('keydown', function(event) {
10var v1 ='#<portlet:namespace/>val1').get('value');
11var v2 ='#<portlet:namespace/>val2').get('value');
13var result ='#<portlet:namespace/>val3');
14result.set('value', v1 + v2);

The Idea is, that sum of values in Field 1 and 2 should be shown in the Result filed. So if I enter e.g. 1 in the Field 1 nothing happens. If I continue enter and put 2 (so now it's 12) ind the Field 1 the value 1 appears in the Result. And so on. If 3 was entered 12 appears in the Result. What I expected is, when I enter 1, it immediately appears in the result. Then when I enter 2 it also immediatelly appears in the Result.

What is wrong with the script?

Thanks and regards,