- This topic has 6 replies, 4 voices, and was last updated 11 years, 3 months ago by Proffie.
-
AuthorPosts
-
ProffieMemberI am aslo trying to get an Input screen which then after pushing the save button drops multiple inputs in a sql database. So far I have magaged to get the sample NewNotes and StickyNotes working (somehow, as I am no js expert)
What I did not like from those examples was,that the js code was inserted into the HTML and “shown” in MobiOne as html.
So I tried to make a .js file called database, which is called from the pushing button.
I tried to debug it both in the test center and in google chrome.
what happens is, that the database is created (which I can see in Chrome dev-tools) but the table is not created and therefore, the Insert function calling from the push butten cannot insert.
I tried to put thedb.transaction(tx.executeSql('CREATE TABLE GENERAL (i
anywhere I thought usefull, but no success
any hints?
remark:
debugger from MB1 tells me, that tx in tx.executeSql(.. is not defined but the statement is the same as in NewNotes and there it works..?
support-octavioMemberHi Proffie,
It is hard to figure out what’s the problem with just one line of code. Can you post a sample design file + code with your progress, so we can review it and help you?
nvtsMemberHello,
This is a function that I use for my SQLite apps.
var createLocker = "CREATE TABLE IF NOT EXISTS Locker (id INTEGER PRIMARY KEY, dlname TEXT, dltype TEXT, dlinfo TEXT)";
function createTable() { db.transaction(function(tx) { tx.executeSql(createLocker,[],table1Success,errorDB); }); }
I use this to create the table and insert a sample record
function populateDB() { createTable(); db.transaction(function(tx) { tx.executeSql('INSERT INTO Locker(dlname,dltype,dlinfo) VALUES ("First Entry", "Other Card", "Entry Details")'); }); }
Hope this helps. Also all this is in the appname_custom.js file in my apps
support-michaelKeymasterThe snippet you provided only gives a small glimpse into how your project might work. The fact that you are having a problem using Chrome leads me to suspect error(s) in your js code somewhere. If you share your entire project we may be able to identify where the issue resides.
Note that MobiOne Test Center does not support webdb debugging; so using chrome dev tools is our recommended approach.
ProffieMemberso, Back from Holiday…
I used the same type of snippets for my database creation. Only when I run the App in Google Chrome, it gives a error message in the phoneui.js
transaction undefined…..function createTable() { db.transaction(function(tx) { tx.executeSql(createLocker,[],table1Success,errorDB); }); }
@nvts: at which stage did you implement the code in your custom.js?
nvtsMemberHello,
This is a function that I assigned to a button event to create the db. It was included in the custom_js after all mobiones js.
Post or send me the project to look at. This would help.
The error you are getting is the same error that I had when using IndexDB in the mobione test center, but when I used in the new test center it ran great with no errors.
Cheers…
ProffieMember@nvts
Ok, that helped. I had it first placed in an external .js file and then placed in between the
phoneui.prePageTransition brackets and that did not work. I put it now at the very end and linked it to the push button. The Tables are now created. I just need to fill them with meaningfull data now. But that is another problem, which I try to solve in another link.
Thanks for the support. -
AuthorPosts