Results 1 to 5 of 5
  1.    #1  
    I hate posting questions to threads unless I've racked my brains and searched high and low for a solution so here I am.

    I've been banging my head against the wall on this one so any help would be GREATLY appreciated.

    I keep getting the error below in my logs:
    Code:
    Uncaught TypeError: Cannot call method 'bind' of undefined, file:///media/cryptofs/apps/usr/palm/applications/com.jltconsultinginc.getitdone/app/assistants/home-assistant.jsjsjs:$131$
    Code is below with line 131 highlighted.
    Code:
    
    
    
    
    HomeAssistant.prototype.activate = function(event) {
    	
    	  
    	 	Mojo.Event.listen(this.controller.get("taskList"), Mojo.Event.listAdd, 
            this.taskListAdd.bind(this));
    		
    		Mojo.Event.listen(this.controller.get("taskList"), Mojo.Event.listChange, 
            this.taskListChange.bind(this));
    		
    		Mojo.Event.listen(this.controller.get("taskList"), Mojo.Event.listDelete, 
            this.taskListDelete.bind(this));	
    		
    		Mojo.Event.listen(this.controller.get("taskList"), Mojo.Event.listReorder, 
            this.taskListReorder.bind(this));			
    		
    		Mojo.Event.listen(this.controller.get("taskList"), Mojo.Event.propertyChange, 
    	 	this.taskCheckBoxChange.bind(this));	
    	
    /* START DATABASE SETUP *************************************************************************/
    	
    	this.db = openDatabase("ext:getItDone", 1, "Get It Done", 20000);
    	this.db.transaction(function(tx){
    	 tx.executeSql('create table if not exists tasks(taskId integer primary key, task text, listOrder integer, completed integer)',
    	 [],
    	 function(tx,result){
    	 },
    	 function(tx,error){
    	 console.log("sql error: " + error);
    	 });
    	 });
    	 
    	/* Get all tasks for list loaded */
    	
    	this.db.transaction(function(tx){
    		tx.executeSql('select * from tasks',
    		[], 
    		this.sqlLoadSuccess.bind(this),
    		this.sqlLoadError.bind(this));
    	}).bind(this);
    	
    }
    
    
    
    HomeAssistant.prototype.sqlLoadSuccess = function(tx, result){
    	for (var i = 0; i < result.rows.length; ++i) {
    		row = result.rows[i];
    		console.log("Result " + row['tagName']);
    	}
    	
    }
  2. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #2  
    you got a typo....

    Backtrace your steps.... disregard the line number.... check all your spellings.

    Palm Pre Backup Utility...done!
    Locate Pre....done!
  3. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #3  
    to test my theory, comment out line 131 and replace it with 119 & 120 and see if you still get the message. If you do then it's complaining about the wrong line number. If you don't then double-check the spelling of the name of the function as well as the Scene Assistant portion of the function.

    Palm Pre Backup Utility...done!
    Locate Pre....done!
  4.    #4  
    Spoke to soon....thought I saw it, but still don't...hmmmm....I'll keep looking.
    Last edited by shrnky; 05/17/2010 at 06:41 PM.
  5.    #5  
    Figure this one out.
    I wasn't binding the anonymous function, but rather the transaction method.
    My Original Code:

    Code:
    	this.db.transaction(function(tx){
    		tx.executeSql('select * from tasks',
    		[], 
    		this.sqlLoadSuccess.bind(this),
    		this.sqlLoadError.bind(this));
    	}).bind(this);
    What it should be:

    Code:
    	this.db.transaction(function(tx){
    		tx.executeSql('select * from tasks',
    		[], 
    		this.sqlLoadSuccess.bind(this),
    		this.sqlLoadError.bind(this));
    	}.bind(this))

Posting Permissions