Page 1 of 1

how to set button condition

Posted: Tue May 19, 2015 9:21 am
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?


how to set button condition

Posted: Tue May 19, 2015 9:40 am
by She

Hi,
you can try this:

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

Goodluck,


how to set button condition

Posted: Tue May 19, 2015 5:52 pm
by Nisa Khalid

not working :(


how to set button condition

Posted: Fri May 22, 2015 12:42 am
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.


how to set button condition

Posted: Mon May 25, 2015 11:04 am
by Nisa Khalid

its working now,thanks yuri