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

note taking app

.....

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

note taking app

Hi Team,
i already got this.
for adding to the localstorage JSON:
code
var notes = Apperyio("txtNotes").val();
var title = Apperyio("txttitle").val()
var result = JSON.parse(localStorage.getItem("NotesStorage"));
if(result == null)
result = [];
result.push({Title: title,Notes: notes});
localStorage.setItem("NotesStorage", JSON.stringify(result));
/code
for updating the value inside the JSON object:
code
var vNotes = localStorage.getItem('NotesStorage');
var inputtitle = Apperyio("txttitle").val();
var json = JSON.parse(vNotes);

for (var i = 0; i < json&#46;length; i++) {
if(inputtitle === json&#46;Title){ &#47;&#47;look for match with name
json&#46;Notes = Apperyio("txtNotes")&#46;val(); &#47;&#47;add two
break; &#47;&#47;exit loop since you found the person
}
}
localStorage&#46;setItem("NotesStorage", JSON&#46;stringify(json)); &#47;&#47;put the object back
/code
delete the specific JSON object:
code
var storedNotes = JSON&#46;parse(localStorage&#46;getItem("NotesStorage"));
var vTitle = Appery("txttitle")&#46;val();
&#47;&#47; storedAddresses is now an array of objects, not just a string

for ( var i = 0; i < storedNotes&#46;length; i++ ) {
if ( storedNotes&#46;Title === vTitle ) {
&#47;&#47; remove the object with storeNumber '714389' from the array
storedNotes&#46;splice(i,1);
}
}
Appery("txttitle")&#46;val("");
Appery("txtNotes")&#46;val("");
localStorage&#46;setItem("NotesStorage", JSON&#46;stringify(storedNotes)); &#47;&#47;put the object back
/code

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

note taking app

Could you check entryText's and entryTitle's values?

Return to “Issues”