Canvas signature touch creates issue in phonegap Canvas signature touch creates issue in phonegap javascript javascript

Canvas signature touch creates issue in phonegap


Well, it can be from many places.

1st of all are you testing it on Android (2.3 or lower)? If so than the problem is most probably that .toDataUrl() is not supported by Android default browser which means it will not work in PhoneGap either.

So first think I suggest you to do is to double check that you really have a string in kundensUnderSkrift.

2nd sometimes WebSql can be tricky I will so to be on the safe side I will use this to create the table:

tx.executeSql("CREATE TABLE IF NOT EXISTS sign(orderNr unique ,rapport,sign STRING)");

WebSql updates do not seem to work at all, so make sure you clear data or uninstall up, than give it another go.

3rd Your statement order look wrong:

tx.executeSql("insert into sign(orderNr,sign,rapport)values(?,?,?)",[nr,rapport,kundensUnderSkrift]);

Should be:

tx.executeSql("insert into sign(orderNr,rapport,sign)values(?,?,?)",[nr,rapport,kundensUnderSkrift]);

If after checking all 3 points it's still not working, I will suggest to try the following UGLY approach:

tx.executeSql("insert into sign(orderNr,sign,rapport) values('"+nr+"','"+ kundensUnderSkrift+"','"+rapport+"');",[],function(tx,success){alert("ALL OK");},function(tx,error){alert(error.message);});

You can use console.log instead of alert but on mobile's I find it a lot easier to do debug with alert. (except windows phone, where alert is not supported by default).

Let me know if this helped you.


You really should be passing error callbacks to transaction() and executeSql() methods - it'll help debugging your database operations in development. You'll want to use something other than alert() for error handling in production.

db.transaction(function(tx) {    // for parts table    tx.executeSql(        "insert into parts(nr,productid,description,toolsVerified) values(?,?,?,?)",        [ nr, productId, desc, tool ],        null, sqlError    );    // for cost table    tx.executeSql(        "insert into costs(nr,date,starttime,endtime,reason,cost) values (?,?,?,?,?,?)",        [ nr, date, startTime, endTime, reason, cost ],        null, sqlError    );    // for sign table    tx.executeSql(        'insert or replace into sign(orderNr,rapport,sign) values (?,?,?)'        [nr, rapport, kundensUnderSkrift],        null, sqlError        );}, xactError);function sqlError(tx, err) {    alert("Statement failed: " + err.message);}function xactError(err) {    alert("Transaction failed: " + err.message);}