Dirk Gissing
Posts: 0
Joined: Sat Oct 12, 2013 4:18 pm

select value change not working

Hello,

I have the following problem: I have a select menu with a couple of options. Beneath that I have a textbox that changes its value based on the option chosen from the select menu. Now the problem is, it only works once, and only for the first item.

For example: I have a select menu with three options "option 1", "option 2" and "option 3". When I choose "option 2" I want the textbox to have the text "option 2". This works, but ONLY the first time, when I change to "option 2" the textbox is still the same.

This is my code:

code
if (Apperyio('select_form').val('one')) {
Apperyio('text').val('one');
}
else if (Apperyio('select_form').val('two')) {
Apperyio('text').val('two');
}
else if (Apperyio('select_form').val('three')) {
Apperyio('text').val('three');
}
/code

Please advise!

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

select value change not working

Hello Dirk,

Use follow code:

var selectedValue =
Apperyio("mobileselectmenu_3").val();

switch(selectedValue){
case "one":{
Apperyio('text').val("text 1");
}
case "two":{
Apperyio('text').val("text 2");
}
}

Dirk Gissing
Posts: 0
Joined: Sat Oct 12, 2013 4:18 pm

select value change not working

Thank you Sergiy, that was the solution! I should have worked with switch in the first place.

Return to “Issues”