473,396 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Unable to save record in access using javascript

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="text/javascript" language="javascript">
  4.  
  5. function validate()
  6. {
  7.  if (document.form.fname.value=="")
  8.  {
  9.  alert("Enter your Name");
  10.  document.form.fname.focus();
  11.  return false;
  12.  }
  13.  
  14.  if (document.form.age.value=="")
  15.  {
  16.  alert("Enter your Age");
  17.  document.form.age.focus();
  18.  return false;
  19.  }
  20.  
  21.  if (document.form.mnumber.value=="")
  22.  {
  23.  alert("Enter your Mobile Number");
  24.  document.form.mnumber.focus();
  25.  return false;
  26.  }
  27.  
  28.  if (document.form.email.value=="")
  29.  {
  30.  alert("Enter your Email ID");
  31.  document.form.email.focus();
  32.  return false;
  33.  }
  34.  
  35.  if (document.form.addr.value=="")
  36.  {
  37.  alert("Enter your Address");
  38.  document.form.addr.focus();
  39.  return false;
  40.  }
  41.  var cn = new ActiveXObject("ADODB.Connection");
  42.  var strcon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Documents and Settings/Imtiaz Sheriff/Desktop/Mini project1/Project/busbooking.mdb;Persist Security  
  43.  
  44. Info=False;"
  45.  cn.open(strcon);
  46.  var rs = new ActiveXObject("ADODB.Recordset");
  47.  var fullname1=document.getElementById('fname').value;
  48.  var age1=document.getElementById('age').value;
  49.  var mobileno=document.getElementById('mnumber').value;
  50.  var emailid1=document.getElementById('email').value;
  51.  var address=document.getElementById('addr').value;
  52.  var row1="insert into customerdetails(fullname,age,mobno,emailid,addr) values (fullname1,age1,mobileno,emailid1,address)";
  53.  rs.open(row1,cn)
  54.  alert("Record submitted successfully");
  55.  cn.close;
  56. }
  57. </script>
  58. </head>
  59.  
  60. <body>
  61. <form action="home.html" method="link" onsubmit="return validate()" name="form">
  62. <h1 align="center">Online Bus Booking</h1>
  63. <table border=0 bgcolor="#FF99CC">
  64. <tr>
  65.     <td><a href="Home.html">Home Page</a>
  66. </tr>
  67. </table>
  68. <br><br><br><br>
  69. <table border="0" align="center">
  70. <tr>
  71.     <th cols="2"><h3>Customer Details</h3></th>
  72. </tr>
  73. <tr>
  74.     <td>Full Name: </td>
  75.     <td><input type="text" name="fname" size="20"></td>
  76. </tr>
  77. <tr>
  78.     <td>Age: </td>
  79.     <td><input type="text" name="age" size="10"></td>
  80. </tr>
  81. <tr>
  82.     <td>Mobile Number: </td>
  83.     <td><input type="text" name="mnumber" size="10"></td>
  84. </tr>
  85. <tr>
  86.     <td>Email ID: </td>
  87.     <td><input type="text" name="email" size="20"></td>
  88. </tr>
  89. <tr>
  90.     <td>Address: </td>
  91.     <td><input type="text" name="addr"></td>
  92. </tr>
  93. <tr>
  94.     <td><input type="submit" value="Submit" onclick="return validate()"></td>
  95.     <td><input type="reset" value="Reset"/></a>
  96. </tr>
  97. </table>
  98. </form>
  99. </body>
  100. </html>
Dec 13 '09 #1
1 2813
gits
5,390 Expert Mod 4TB
you should describe what the error or issue exactly is - just posting code doesn't help much since we need to know what the problem is.

kind regards
Dec 14 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Huw Davies | last post by:
I have created a split MDB that was intended for use on a single PC.The user has asked for it now to be setup as a multi-user (without security) system. I have placed the "application" mdb on...
4
by: Susan Bricker | last post by:
I have a command button on a form that is supposed to Delete the record being displayed. The record is displayed one to a form. The form is not a Pop-Up nor is it Modal. Tracing the btnDelete...
4
by: GrantS | last post by:
I am having a problem closing a popup window opened modally. When I try to close the window (when the user hits save button and the data has been processed), the Popup window opens as a full screen...
0
by: Seok Bee | last post by:
Dear Experts, In my web application, I'm having a button to view an attachment. After I retrieve the record from database (Ms. Access), I have a button to view the attachment (if there is any)....
6
by: Seok Bee | last post by:
Dear Experts, In my web application, I'm having a button to view an attachment. After I retrieve the record from database (Ms. Access), I have a button to view the attachment (if there is any)....
3
by: den 2005 | last post by:
Hi everyone, Here is code working on..Trying to insert record with a column with Image or VarBinary datatype in sql database from a existing jpeg image file, then retrieve this image from...
3
by: Angus | last post by:
I have a web page with a toolbar containing a Save button. The Save button can change contextually to be a Search button in some cases. Hence the button name searchsavechanges. The snippet of...
2
by: Ian | last post by:
I am trying to save the current record on a form before opening a report, doesn’t sound to hard does it? The code on a buttons on click event goes like this: DoCmd.DoMenuItem acFormBar,...
7
by: Neil | last post by:
Was working in A2003 and noticed that the Save Record item on the Records menu was not available when the record was not dirty. In A2000, Save Record was always available. (This is a problem for me...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.