Page 1 of 1

select value change not working

Posted: Fri May 02, 2014 11:56 am
by Dirk Gissing

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!


select value change not working

Posted: Fri May 02, 2014 12:24 pm
by Serhii Kulibaba

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");
}
}


select value change not working

Posted: Fri May 02, 2014 12:36 pm
by Dirk Gissing

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