Page 1 of 2

note taking app

Posted: Thu Sep 10, 2015 3:24 am
by She

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


note taking app

Posted: Thu Sep 10, 2015 4:51 am
by She

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


note taking app

Posted: Thu Sep 10, 2015 7:23 pm
by Serhii Kulibaba

Hello,

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

instead of:
Appery('txttitle').val


note taking app

Posted: Fri Sep 11, 2015 1:45 am
by She

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


note taking app

Posted: Fri Sep 11, 2015 6:31 am
by She

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


note taking app

Posted: Fri Sep 11, 2015 7:18 am
by Illya Stepanov

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


note taking app

Posted: Fri Sep 11, 2015 8:24 am
by She

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


note taking app

Posted: Fri Sep 11, 2015 8:11 pm
by Serhii Kulibaba

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


note taking app

Posted: Sun Sep 13, 2015 1:49 am
by She

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


note taking app

Posted: Tue Sep 15, 2015 4:08 am
by She

Sergiy, any updates here?