how to set button condition

This forum contains topics that were moved from Get Satisfaction
Nisa Khalid
Posts: 0
Joined: Tue May 05, 2015 1:36 pm

how to set button condition

Post by Nisa Khalid »

hello,
i need some help about how to link button to other page.
the scenario :
parents allow to view list of kids after they register their kids. this is my ui to display the register details Image

my problem is i want to set that button"continue" if their age is 4,then it will navigate
to the page for 4 years old?
how can i set the button?

She
Posts: 0
Joined: Wed Oct 08, 2014 12:46 am

how to set button condition

Post by She »

Hi,
you can try this:

code
var age = Appery('lblChildAge').text();
if(age == 4){
Apperyio.navigateTo('page_name',{});
}
/code

Goodluck,

Nisa Khalid
Posts: 0
Joined: Tue May 05, 2015 1:36 pm

how to set button condition

Post by Nisa Khalid »

not working :(

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

how to set button condition

Post by Yurii Orishchuk »

Hi Nisa,

She provided you with correct code.

Please add to this code some logs to see in console what is wrong:

pre

//"lblChildAge" should be changed with your label name where you store "age".
var age = Appery('lblChildAge').text();

console.log("age = " + age);

age = parseInt(age);

if(age == 4){

Code: Select all

 console.log("navigate to goal page"); 

 //"page_name" should be changed with your goal page name. 
 Apperyio.navigateTo('page_name',{}); 

}

/pre

Regards.

Nisa Khalid
Posts: 0
Joined: Tue May 05, 2015 1:36 pm

how to set button condition

Post by Nisa Khalid »

its working now,thanks yuri

Post Reply