Page 2 of 2

Event based property change of other component based on components own property

Posted: Mon Jan 02, 2012 5:53 am
by Feeniix_

Cool, so if I've created a LocalStorage variable called termsAccepted under 'data mapping' view, can I then have an onClick event for the continueButton that runs:

Tiggr.setItem(termsAccepted, 1);


Event based property change of other component based on components own property

Posted: Mon Jan 02, 2012 5:57 am
by maxkatz

Yes, but you should create the Local Storage variable via Create Local Storage Variable action.


Event based property change of other component based on components own property

Posted: Mon Jan 02, 2012 6:28 am
by Feeniix_

Of course, thank you. I'm having trouble with the home page, checking the variable. My code is:

var s = localStorage.getItem('termsAccepted');

if (s == null) {
navigate(terms);
}
else {
alert(s);
}

If I remove "navigate(terms);" and just put an alert there it seems to work OK. Do you know what I'm doing wrong?


Event based property change of other component based on components own property

Posted: Mon Jan 02, 2012 6:35 am
by maxkatz

There is a little abstraction on top of the pages. The pages are defined like this:

code
function pageItem(pageName, pageLocation) {
this.name = pageName;
this.location = pageLocation;
}
Tiggr.AppPages = [
new pageItem('mobilescreen1', 'screen-D443.html'), new pageItem('current', 'screen-D443.html')];
/code

You can see it from page source (look for page JS file). So, to navigate, you would need to create such JavaScript object.


Event based property change of other component based on components own property

Posted: Mon Jan 02, 2012 6:41 am
by Feeniix_

Hi Max,

I'm sorry but I don't understand this. I don't even know how to find the page javascript file? I can only see what is available to me in the app builder tool.

Are you able to help me further? Where do I put my

var s = localStorage.getItem('termsAccepted');

if (s == null) {
navigate(terms);
}

or do I have to change it?

Thank you,
Jaimee


Event based property change of other component based on components own property

Posted: Mon Jan 02, 2012 6:59 am
by maxkatz

The page you pass to navigation has to be created like this:

code
new pageItem('mobilescreenX', 'screen-XXXX.html')
/code

You can use Firebug (or Google Chrome Development Tools) to view the generated page source. I'd need access to your project to help with navigation. Please share your project with a href="mailto:support@gotiggr.com" rel="nofollow"support@gotiggr.com/a


Event based property change of other component based on components own property

Posted: Mon Jan 02, 2012 8:21 am
by Feeniix_

Hi Max,

I shared my project. The main screen is called home, which I want to load screen terms if the variable termsAccepted is null. I'm heading out for a few hours now, so wont be able to answer any questions. Any help with this is greatly appreciated!

Kind regards,
Jaimee


Event based property change of other component based on components own property

Posted: Mon Jan 02, 2012 5:04 pm
by maxkatz

Try this:

code
var page = new pageItem('terms', 'screen-E71C.html');
navigate(page);
/code


Event based property change of other component based on components own property

Posted: Tue Jan 03, 2012 7:24 am
by Feeniix_

That doesn't seem to work. Is it supposed to be like this:

var s = localStorage.getItem('termsAccepted');
var page = new pageItem('terms', 'screen-E71C.html');

if (s == null) {
navigate(page);
}

on Load on the home page?


Event based property change of other component based on components own property

Posted: Tue Jan 03, 2012 5:49 pm
by maxkatz

Sorry, the navigate API is a little bit different:

code
var s = localStorage.getItem('termsAccepted');
if (s != 'yes') {
navigateTo('accept', 'ajax');
}
else {
navigateTo('page3', 'ajax');
}
/code