John4930205
Posts: 0
Joined: Tue Aug 28, 2012 4:30 am

How to assign Event & Action for "select menu" component

I thought this would be a basic process, but I can't seem to find any info on how to assign events & actions for each of the drop down items after creating a "select menu" component.

Do you know of any tutorial page or simple explanation on how to do this? Thx!

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to assign Event & Action for "select menu" component

Events are assigned to the component itself (Select Menu), not to individual values. Simply select the component, then add any available event (Events tab) and then add any available action. For example, you can use Value Change can be used when a new value is selected. Hope this helps.

John4930205
Posts: 0
Joined: Tue Aug 28, 2012 4:30 am

How to assign Event & Action for "select menu" component

I added Value Change and applied a custom javascript to the "select menu" component. It runs the same custom javascript for all the drop down items... How do I assign a specific custom javascript to a specific drop down item? Do I need to Set Property or Set Local Storage Variable?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to assign Event & Action for "select menu" component

Check the value and run different code, you can use if-statement. This is how the Select Menu component works in the browser (nothing to do with Tiggzi builder).

John4930205
Posts: 0
Joined: Tue Aug 28, 2012 4:30 am

How to assign Event & Action for "select menu" component

I'm using "Value Change" and trying to check the value and run a code using if statement. I am not sure if I am setting the variable correctly below. Is this how you set a variable for Select Menu?

var myVar = Tiggr('mobileselectmenu1');

if (myVar == "vici"){

do something here...

} else {

do something else here...

}

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to assign Event & Action for "select menu" component

code
Tiggr('mobileselectmenu1');
/code

or

code
Tiggzi('mobileselectmenu1');
/code

returns a reference to jQuery Mobile component (http://help.gotiggr.com/documentation.... To get the value you need to do:

code
Tiggzi('mobileselectmenu1').val();
/code

When you run custom JavaScript, the component on which the event is invoked is passed as an argument (this), so you can also use this code:

code
$(this).val();
/code

John4930205
Posts: 0
Joined: Tue Aug 28, 2012 4:30 am

How to assign Event & Action for "select menu" component

Thank you Max! This is exactly what I needed! Solved.

Haim
Posts: 0
Joined: Wed Sep 05, 2012 9:15 am

How to assign Event & Action for "select menu" component

If I want to initialize the selection (let's say upon screen load) to some localStorage variable, how do I set it?

Let's say I have two settings with values "A" and "B"...

can I use something like:

$(this).val = 'A';

or what would I use?

Haim
Posts: 0
Joined: Wed Sep 05, 2012 9:15 am

How to assign Event & Action for "select menu" component

I should add that I also tried setProperty and that didn't seem to work.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How to assign Event & Action for "select menu" component

Hello! Try next:

Tiggr('selectMenu').append(""+"Something"+"") - edding element to dropdown

Tiggr('selectMenu').selectmenu("refresh"); - refresh dropdown after you add element

Return to “Issues”