I'm a little confused about using the select component.
I need that when user select a option, a different page is displayed for each option.
Thanks!
Hello! You have to use Run JS action. Add code which retrieves current Select value and execute necessary action depending on current value.
return {
'field' : data.field '',
'field1' : data.filed1 0,
...
}
Something like that? Sorry but I don't know JavaScript =( Researched as much as I can...
var newPath = $($(Appery("mobileselectmenu_6")).find("option:selected")).attr("value");
Appery('mobileimage_9').refresh();
Hi Ignacio,
Answered directly. Duplicate here.
Create a function in custom JavaScript which accepts parameters that define what function to call. Run this function on 'value change' event.
To get a value of selected component 'select' value run this code:preAppery("mobileselectmenu").find(":selected").val();/prewhere 'mobileselectmenu' is a component name.
I have a related, though not exactly the same question.
I want to be able to iterate through and save all the values of drop down elements from select menu to an array.
Array_i = Appery("selectmenu").val_of_option_i;
How may I go about it? If possible to suggest the way to access individual elements in a loop and how to fetch the length to iterate though, that might help?
Thank you.
Below code should work:
pre
code
var values = [];
var options = Appery("mobileselectmenu_12").find("option");
for(var i = 0; i < options.length; i++){
var option = jQuery(options);
Code: Select all
values.push({value: option.val(), view: option.text()});
}
//show array in the browser console
console.log(values);
/code
/pre
It does! Many thanks.
hi
Your code
var values = [];
var options = Appery("mobileselectmenu_12").find("option");
for(var i = 0; i < options.length; i++){
var option = jQuery(options);
values.push({value: option.val(), view: option.text()});
}
//show array in the browser console
console.log(values);
works but then I see this at the end
7: Objectvalue: ""view: "↵
Shouldn't it be options.length - 1?
Thanks,
M&M
Murali,
No, there shouldn't be options.length - 1
Because the condition is
prei < options.length/pre
not
prei /pre
Please inspect the element. look what options there are in select and you'll see if everything works correctly or not. http://devcenter.appery.io/documentat...