This topic is locked

using .length to count items - Multiselect dropdown

7/27/2016 4:32:14 AM
PHPRunner General questions
D
dbdoblar author

Hello,
Anyone who is kind enough to explain why I have different results.
I want to count the items automatically, I am using the multi-select dropdown and I used this script in my JavaScript OnLoad Event.

var ctrlQTY = Runner.getControl(pageid, 'quantity');

var x = Runner.getControl(pageid,'item');

var ctrlQTY1 = x.getValue();

ctrlQTY.setValue(ctrlQTY1.length);
};

ctrlItem.on("change", AddQty);


It is counting the characters when I select only 1 item, but it is working when I select more than 1 item.
Please help..
Thank you in advance...