Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
need to check duplicate item in my table before insert date .But i am getting error while checking.Here is my code.I need to check whether the element already exist then return false If not then return true.And create a new entry

function validationField() {
     db.transaction(getallTableCntend, errorCB);
   }

   function getallTableCntend(tx) {
       tx.executeSql('SELECT * FROM CaseTable', [], queryexcecute, errorCB);
   }
   function queryexcecute(tx, result) {
       var len = result.rows.length;

       for (var i = 0; i < len; i++) {
         if(result.rows.item(i).CaseName ==$('.caseName_h').val()){
           alert("Folder is already Exit.");
           isvalid=false;
           Break;
           return;;
         }
       }
      }


I am calling this like this.
$(document).on('click', '#AddButton', function() {
     isvalid = validationField();
    if (isvalid) {
            insertData();
            window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, onFileSystemFail);
    }
});
Posted
Updated 12-Jul-13 8:55am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900