I have a form populated by SQLite/javascript. I have two pages, one that contains the form and displays a list of records by title that were added to the database. Each title has an edit link that populates the form with that items data. I have another page that I want to just display each record as static data when I click the title. I'm having trouble figuring out how to modify the code to just display one record when I do an onclick on the title. It works for the form, but not on the second page, which has no form. The second page lists the titles but displays all records when I click a title (which is to be expected since I just copied the query from the form page). Here's some code snippets from my second page:
showList displays the titles, with a link to showRecords. I need showRecords to just show the record for the title clicked, not all records.
I've searched for a solution but can't seem to figure out how to modify the code.Code:function showList() { results.innerHTML = ''; db.transaction(function(tx) { tx.executeSql(selectAllStatement, [], function(tx, result) { dataset = result.rows; for (var i = 0, item = null; i < dataset.length; i++) { * * item = dataset.item(i); * * results.innerHTML +=* * * '<a href="#" onclick="showRecords('+i+')">' + item['title'] + '</a>'; } }); }); } function showRecords() { records.innerHTML = ''; db.transaction(function(tx) { tx.executeSql(selectAllStatement, [], function(tx, record) *{ dataset = record.rows; for (var i = 0, item = null; i < dataset.length; i++) { * * item = dataset.item(i); * * records.innerHTML +=* * * item['TArea']; } }); }); } **
Thanks for any help.


Reply With Quote

Bookmarks