Current location: Hot Scripts Forums » General Web Coding » JavaScript » JavaScript calling Sqlite / local-Storage


JavaScript calling Sqlite / local-Storage

Reply
  #1 (permalink)  
Old 02-16-11, 09:23 AM
Brandon Brandon is offline
New Member
 
Join Date: Feb 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
JavaScript calling Sqlite / local-Storage

I have code working that creates a database and creates tables. my problem is that when i run an onclick function it comes back with can not read property ' null'.

Quote:
function saveAddClientbtn()
{

var myDB=openDatabase('ttbd', '1.0');


var firstNameaddClient=document.getElementById('firstN ameaddClient');
var lastNameaddClient=document.getElementById('lastNam eaddClient');
var companyaddClient=document.getElementById('companya ddClient');
alert(firstNameaddClient);
//var firstNameaddClient=document.getElementById('client Form.firstNameaddClient');
//var lastNameaddClient = document.getElementById('clientForm.lastNameaddCli ent');
//var companyaddClient = document.getElementById('clientForm.companyaddClie nt');

myDB.transaction(
function (transaction) {
transaction.executeSql('INSERT into clienttbl(firstName, lastName, companyName) VALUES("'+firstNameaddClient+'", "'+lastNameaddClient+'", "'+companyaddClient+'");', []);

});
}
Reply With Quote
  #2 (permalink)  
Old 02-16-11, 11:43 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
To what does the onclick event refer?

Also note that this code is EXTREMELY vulnarable to hackers! You're showing your entire database structure and tables to any visitor...
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #3 (permalink)  
Old 05-14-11, 05:54 AM
zota zota is offline
New Member
 
Join Date: May 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Brandon View Post
I have code working that creates a database and creates tables. my problem is that when i run an onclick function it comes back with can not read property ' null'.
you wrote:

var firstNameaddClient=document.getElementById('firstN ameaddClient');

but seems it should it be:

var firstNameaddClient=document.getElementById('firstN ameaddClient').value;

with .value at the very end...
tkx
Reply With Quote
Reply

Bookmarks

Tags
database, javascript, sqlite


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Senior JavaScript Developer - Full Time - Permanent - London AJAX, CSS, JSONP Chris Peacock Job Offers & Assistance 0 01-19-10 12:28 PM
Regarding calling a codebehind method in c# using javascript vishalsharma.net JavaScript 1 08-31-06 08:08 AM
Regarding calling a codebehind method in c# using javascript vishalsharma.net ASP.NET 1 08-31-06 06:06 AM
help calling a JAvascript function sharijl JavaScript 3 02-12-06 01:31 PM
netBAQ™ External Storage Service - (Virtual Backup Storage) BurstNET General Advertisements 1 09-12-05 08:35 AM


All times are GMT -5. The time now is 02:04 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.