473,500 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Value of list is lost when form is submitted

vikas251074
198 New Member
I am using Oracle 9i and ASP

I have empno, empname, designation, category, dob.
Category have two option 'S' or 'O'

When I enter empno, empname, designation, category and dob
and when I press enter key all the data remains on the form but only list value is lost. what should I do ? How can I solve this.

Expand|Select|Wrap|Line Numbers
  1. <%@ Language=VBScript%>
  2. <%Option Explicit%>
  3. <html>
  4. <head>
  5. <title>Barauni Refinery - Post Retirement Data Management </title>
  6. </head>
  7. <%
  8. Dim R
  9. Dim R1 
  10. Dim vempno, vempname, vdesign, vcategory
  11. Dim vdobyyyy, vdobmm, vdobdd
  12.   If Not IsEmpty(Request.Form("submit")) then
  13.     vempno = Request.Form("vempno")
  14.     vempname = Request.Form("vempname")
  15.     vdesign = Request.Form("vdesign")
  16.     vcategory = Request.Form("vcategory")
  17.     vdobyyyy = Request.Form("vdobyyyy")
  18.     vdobmm = Request.Form("vdobmm")
  19.     vdobdd = Request.Form("vdobdd")
  20.     If len(vempno) = 0 then
  21.       errorMsg = "You must enter employee number."
  22.     End If
  23.     If len(errorMsg) = 0 Then
  24.       If len(vempname) = 0 Then
  25.         errorMsg = "Your must enter either employee name."
  26.       Elseif len(vempname) > 20 Then
  27.         errorMsg = "The employee name > 20 characters. Please reduce the size."
  28.       Else
  29.         For i = 1 to len(vempname)
  30.           If instr(1, "_/()[]{}abcdefghijklmnopqrstuvwxyz0123456789 ", mid(vempname, i, 1), vbTextCompare) = 0 then
  31.             errorMsg = "The employee name is invalid. Please re-enter this field."
  32.             Exit For
  33.           End If
  34.         Next
  35.       End If
  36.     End If
  37.     If len(errorMsg) = 0 Then
  38.       conn.Close
  39.       conn.Mode = adModeReadWrite
  40.       conn.Open
  41.       R.Open "Select * from SABF", conn, 2, 3
  42.       R.Addnew
  43.       R("empno") = vempno
  44.       R("empname") = vempname
  45.       R("design") = vdesign
  46.       R("category") = vcategory
  47.       R("dob") = Cdate(vdobmm & "/" & vdobdd & "/" & vdobyyyy)
  48.       R.UPdate
  49.     End If
  50.   End If %>
  51.     <form method="POST" action="sabf.asp">
  52. <%
  53.       If len(errorMsg) > 0 Then
  54.         Response.Write "<p><font color='red'>" & errorMsg & "</font></p>"
  55.       End If
  56. %>
  57.  
  58.       <table width=900>
  59.         <tr>
  60.           <table align="center">
  61.             <tr>
  62.               <td align="center"><font face="arial"><h3>SABF Entry</h3></font></h3>
  63.             </tr>
  64.  
  65.           </table>
  66.         </tr>
  67.         <tr>
  68.           <table align="center">
  69.             <tr>
  70.               <td align="right"><font face="arial" size=2>Employee No : </font></td>
  71.               <td align='left'><input type="text" style="width:100px" name="vempno" value="<%=vempno%>"></td>
  72.               <td align="right"><font face="arial" size=2>Employee Name : </font></td>
  73.               <td align='left'><input type="text" style="width:300px" name="vempname" value="<%=vempname%>"></td>
  74.             </tr>
  75.             <tr>
  76.               <td align="right"><font face="arial" size=2>Designation : </font></td>
  77.               <td align='left'><input type="text" style="width:200px" name="vdesig"></td>
  78.               <td align="right"><font face="arial" size=2>Category : </font></td>
  79.               <td align="left">
  80.                  <font face="arial" size=2><select name="vcategory" value="<%=vcategory%>">
  81.                        <option value="O">Officer</option>
  82.                        <option value="S" selected>Staff</option></select>
  83.                  </font>
  84.               </td>
  85.             </tr>
  86.             <tr>
  87.               <td align="right"><font face="arial" size=2>Date of Birth : </font></td>
  88.               <td>
  89.                 <select name="vdobyyyy" value="<%=vdobyyyy%>">
  90.                   <%i=1965
  91.                   do while i <= 2010
  92.                     If i = 2009 Then%>
  93.                       <option value="2009" selected>2009</option>
  94.                     <%Else%>
  95.                         <option value="<%=i%>"><%=i%></option>
  96.                     <%End If
  97.                     i = i + 1
  98.                   loop%>
  99.                 </select>
  100.                 <select name="vdobmm" value="<%=vdobmm%>">
  101.                   <%i=1
  102.                   Do while i <= 12
  103.                     If i = Cint(vdobmm) then%>
  104.                       <option value="<%=vdobmm%>" selected><%=vdobmm%></option>
  105.                     <%Else%>
  106.                       <option value="<%=i%>"><%=i%></option>
  107.                     <%End If
  108.                     i = i + 1
  109.                   loop%>
  110.                 </select>
  111.                 <select name="vdobdd" value="<%=vdobdd%>">
  112.                   <%If vdobyyyy mod 4 = 0 And vdobmm = 2 Then
  113.                     no_of_day = 29
  114.                   ElseIf vdobyyyy mod 4 <> 0 and vdobmm = 2 Then
  115.                     no_of_day = 28
  116.                   ElseIf vdobmm=4 or vdobmm=6 or vdobmm=9 or vdobmm=11 Then
  117.                     no_of_day = 30
  118.                   Else
  119.                     no_of_day = 31
  120.                   End If
  121.                   i=1
  122.                   Do while i <= no_of_day
  123.                     If i = Cint(vdobdd) Then%>
  124.                       <option value="<%=vdobdd%>" selected><%=vdobdd%></option>
  125.                     <%Else%>
  126.                       <option value="<%=i%>"><%=i%></option>
  127.                     <%End If
  128.                     i = i + 1
  129.                   loop%>
  130.                 </select><font color='blue' size=2>(yyyy-mm-dd)</font>
  131.               </td>
  132.             </tr>
  133.         <tr>
  134.           <table align="center">
  135.             <tr>
  136.               <td align="center"><input type="Submit" name="submit" value="Save">
  137.                                  <input type="reset" name="reset" value="Reset">
  138.               </td>
  139.             </tr>
  140.           </table>
  141.         </tr>
  142.       </table>
  143.     </form>
  144. </body>
  145. </html>
  146.  
Oct 21 '09 #1
0 1417

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

Similar topics

3
9267
by: Jeremy Epstein | last post by:
I've got a 4-page form that lets users enter a whole lot of information, which is then submitted and emailed at the end. All the fields are stored as session data. The whole thing works fine: ...
3
4185
by: Mark R | last post by:
I have one .asp page with a SELECT pulldown list on it and some INPUT fields. When SUBMIT is clicked the form data is submitted to that same page and validated. If INPUT fields are empty the asp...
4
3001
by: dmiller23462 | last post by:
So here's my problem.....I need to set up different email distributions based on which option in the following Select form has been chosen....For instance if "Putaway" is chosen it needs to email...
9
2913
by: ckerns | last post by:
I want to loop thru an array of controls,(39 of them...defaults = 0). If value is null or non-numeric I want to assign the value of "0". rowString = "L411" //conrol name if (isNaN(eval...
5
1858
by: cmc_dermo | last post by:
I have a form that has a select list. A user chooses a value and the page refreshes showing the selected value in the dropdown box. So I want to use Javascript to get the selected query from...
2
4981
by: Ashish | last post by:
Hi All, I have a server runnable textbox control. I also have a server side button object but I hook up javascript to it to show a modal dialog. Upon return it places the value in the textbox...
3
23742
by: Celine | last post by:
I have a webform with multiple panels with textboxes, dropdownlists, radiobuttonlists, etc. The user navigates through the panels and then submits the information at the end. The first panel...
2
4529
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
2
1432
by: godkrishna | last post by:
Hi Guys.. I am new to javascript.. pls bare with me :) In my form, i have a table with two columns. first column has checkboxes and second has dropdown lists. On check of each check box.....
0
7018
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
7182
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
7232
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7397
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5490
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,...
0
3110
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...
0
3106
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
672
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
316
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...

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.