Feeniix_
Posts: 0
Joined: Tue Dec 20, 2011 5:45 am

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

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);

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

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

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

Feeniix_
Posts: 0
Joined: Tue Dec 20, 2011 5:45 am

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

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?

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

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

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.

Feeniix_
Posts: 0
Joined: Tue Dec 20, 2011 5:45 am

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

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

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

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

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

Feeniix_
Posts: 0
Joined: Tue Dec 20, 2011 5:45 am

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

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

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

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

Try this:

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

Feeniix_
Posts: 0
Joined: Tue Dec 20, 2011 5:45 am

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

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?

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

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

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

Return to “Issues”