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

note taking app

Hi Team,
Is there a way how can i create an note taking app?
or a documents, tutorial. but instead of using the database, it will use localstorage to store the text.

Thanks,
She

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

note taking app

Hi Team,
.push is not working. this is the code:

code
// Parse the JSON stored in allEntriesP
var existingEntries = JSON.parse(localStorage.getItem("testObject"));
if(existingEntries == null) existingEntries = [];
var entryTitle = Appery('txttitle').val;
var entryText = Appery('txtarea').val;
var entry = {
"title": entryTitle,
"text": entryText
};
localStorage.setItem("entry", JSON.stringify(entry));
// Save allEntries back to local storage
existingEntries.push(entry);
localStorage.setItem("testObject", JSON.stringify(existingEntries));
/code

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

note taking app

Hello,

Please use:
Appery('txttitle').val()

instead of:
Appery('txttitle').val

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

note taking app

Hi Sergiy,
Thank for replying, i already tried that and still the .push is "Uncaught TypeError: undefined is not a function", what do you think is the problem? i cant see any problems to the code.

Thank you,
She

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

note taking app

this is the jsfiddle:
http://jsfiddle.net/Bxn2t/1/

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

note taking app

Hi She - Could you please explain how you have implemented this in Appery.io?

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

note taking app

Hi Ilya,

First created a model and storage screenshot below:
Image

Image

and then i put text area, text component the names are the ff::
txttitle - Appery('txttitle').val();
txtarea - Appery('txtarea').val();

the last step is i put the ff. code to the button:code
// Parse the JSON stored in allEntriesP
var existingEntries = JSON.parse(localStorage.getItem("NotesStorage"));
if(existingEntries == null) existingEntries = [];
var entryTitle = Appery('txttitle').val();
var entryText = Appery('txtarea').val();
var entry = {
"title": entryTitle,
"text": entryText
};
localStorage.setItem("entry", JSON.stringify(entry));
// Save allEntries back to local storage
existingEntries.push(entry);
localStorage.setItem("NotesStorage", JSON.stringify(existingEntries));/code

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

note taking app

Did you add input components with names "txttitle" and "txtarea"? Could you check entryText's and entryTitle's values?

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

note taking app

Of course. I added that components name which is txttitle = TEXTINPUT and txtarea = TEXTAREA

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

note taking app

Sergiy, any updates here?

Return to “Issues”