473,779 Members | 2,001 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 1428

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

Similar topics

3
9292
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: 1. On my local box (WinXP / Apache2 / PHP4) using IE6 2. On my local box using Firefox1 3. On my hosted server (RHLinux / Apache1.3 / PHP4) using IE6
3
4196
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 code will insert a visual indicator (e.g. *) to convey that the field must be filled in. However, if the user has made a selection in the pulldown list and has left an INPUT field empty, when the form reappears after validation, the pulldown menu...
4
3020
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 User1@here.whatever and User4@here.whatever but if "Loaded" is chosen it needs to email User2@here.whatever and User3@here.whatever, etc, etc... I'm aware that the only thing that really needs to change is the "Mail.AddAddress" line (at least...
9
2935
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 ("document.forms."+rowString+".value")) == true ) { //this alert works if the value is a letter,i.e,"a" alert("You have entered an non-numeric value.\nEnter a number in the appropriate box.");
5
1885
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 the form. I then want to pass it as a hidden field. So for example the section of the page I'm interested in will look like
2
5013
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 (client side script). The problem is that after it places the value, postback occurs and value is lost. I have tried overriding SaveViewState and LoadViewState but it doesnt help (for some super cool reason load is called first after postback rather...
3
23774
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 contains a text box where users can enter a search term. A "next" button displays the following panel causing a stored procedure to populate a dropdown list. The dropdown list displays the results of the search, and requires users to select an...
2
4556
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 set to...it is set to false. Can someone show me what I am doing wrong and tell me the correct way? Thank you. In the page load event, I am doing the following:
2
1451
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.. certain 'options' are addded/removed from its corresponding dropdown list. My problem is, after adding/removing the 'options' dynamically, if I select the newly added option and submit the form, the corresponding value for the newly added option is...
0
9632
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
9471
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10302
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
10071
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
8958
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
7478
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
5372
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...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3631
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.