473,666 Members | 2,075 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unable to save record in access using javascript

1 New Member
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 2831
gits
5,390 Recognized Expert Moderator Expert
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
2698
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 one PC and linked to the "data" mdb across a Windows network. The linking works fine, but when I open a form that is supposed to display records on a continuous form, only existing records are displayed, i.e. there is no "blank" new record...
4
7842
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 event routine shows that AllowDeletions is TRUE. When the Delete button is clicked (without TRACE ON), I get a 'beep', the recordselector (vertical bar on left of form) gets dark in color, but the record is not deleted. Also, there is no error...
4
34862
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 as a new window. The original window plus the Modally opened Pop remain in a separate window. What I want to do is close the popup and return to the original window with its view state maintained. The control use to fire the popup window...
0
2346
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). The button work fine when I run it at my local machine. However, when I moved all the programs over to the server, I am unable to view the attachment, although I have the file physically at the server. The error message that I got is: ...
6
3531
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). The button work fine when I run it at my local machine. However, when I moved all the programs over to the server, I am unable to view the attachment, although I have the file physically at the server. The error message that I got is: ...
3
5233
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 database and display it in a Image web control dynamically(at runtime). The process after being displayed in the web control, user click insert/add button, it converts the image(jpeg) file to bytes and store it the database with Image or VarBinary...
3
3666
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 html is: <a class="searchsavechanges btn btn3d tbbtn" href="javascript:" style="position:static"> <div id="TBsearchsavechanges">Search</div> </a>
2
64489
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, acRecordsMenu, acSaveRecord, , acMenuVer70 'First save record I used this for many years with problems using Access 97, when the database is upgraded to Access 2000 or later I occasionally get an error message saying “Save Command is not available now”.
7
2169
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 because I have Docmd.Runcmd acCmdSaveRecord code all over the place, which never gave an error before. But now it was giving an error when the Save Record menu command wasn't available.) So I went back to A2000 and confirmed that the Save...
0
8448
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8871
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8552
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2773
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.