Solved

Submit button and reset button don't work

Posted on 2004-03-31
2
1,111 Views
Last Modified: 2008-03-06
Hi!

I have a asp page with a form that's supposed to send values to another asp page that inserts records in a database. The problem is that the form doesn't seem to work. When I click the submit button (or the reset button) nothing happens. I can't figure out why.

Posting the code here even if it's a lot.

MaB

--------------------------------------------------------------------------
<%@ Language=VBScript %>

<%
Dim Databas, strConn
Set Databas = Server.CreateObject ("ADODB.Connection")

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=\\m02s009\atnetdb$\n\ny\frv1.mdb"

input_datum = Now()

'START - Per Andersson TE, 2003-10-16
'öppna connection
Databas.Open strConn

UserAccount = Request.ServerVariables("LOGON_USER")
lngLen = len(UserAccount)
lngPos = InStr(1, UserAccount, "\", vbTextCompare)
If lngPos <> 0 Then
   UserAccount = Mid(UserAccount, lngPos + 1, lngLen - lngPos)
End If

v_user = false  
SQLstr = "SELECT * FROM Anst WHERE konto = '" & UserAccount & "'"
set poster = Databas.execute(SQLstr)

if poster.eof then
   v_user = false
else
   v_user = true
end if      
'STOP - Per Andersson TE, 2003-10-16
%>

<html>
<head>
<title>Ny frånvaro</title>
<link rel="stylesheet" type="text/css" href="../../stylesheets/frv.css">
<base target="_self">
</head>

<body>
<h1>Lägg till frånvaro!</h1>
<div id="div3"
<form action="RegistreraFrvIDB.asp" method="post">
<%
   if v_user = true then
%>                  

<table cellspacing=10 cellpadding=0 align=left border=0 style="border-collapse: collapse" bordercolor="#111111">
    <tr valign=top>
      <td colspan="2"><b>Uppgifter markerade med * &auml;r obligatoriska.</b></td>
    </tr>
    <tr valign=top>
      <td width="76" height="38" style="border-left-width: 1; border-right-style: inset; border-right-width: 1; border-top-width: 1; border-bottom-width: 1">
        <div align="right"> <span lang="sv">Plats/Orsak</span>&nbsp;</div>
      </td>
      <td>
        <input type="hidden" name="anstID" value="<%=poster("anstID")%>">
        <select size="1" name="Lokal">
        <%
        SQLstr = "SELECT * FROM Lokal ORDER BY lnamn"
        set posts = Databas.execute(SQLstr)
        Do Until posts.EOF%>
            <option><%=posts("beteckn")%></option>
        <%
        posts.MoveNext
        loop
        %>
        </select>
        <select size="1" name="Orsak">
        <%
        SQLstr = "SELECT * FROM Orsak ORDER BY frvOrsak"
        set post = Databas.execute(SQLstr)
        Do Until post.EOF%>
            <option><%=post("frvOrsak")%></option>
        <%
        post.MoveNext
        loop
        %>
        </select>&nbsp;<i>(Du måste
        ange en orsak ELLER en beskrivning)</i></td>
    </tr>
    <tr valign="top">
      <td width="76" height="22" style="border-left-width: 1; border-right-style: inset; border-right-width: 1; border-top-width: 1; border-bottom-width: 1">
        <div align="right"><span lang="sv">Beskrivning</span>&nbsp;</div>
      </td>
      <td>
        <textarea rows=7 size=25 name="description" value="" cols="39"> </textarea>
        <br>
        <input type="checkbox" name="privat" value="0">
        <b>Visa beskrivningen endast för mig!</b></td>
      </tr>
   <input type="hidden" name="namn" value="<%=UserAccount%>">
   
<%if poster("mail") = "" then%>
      <tr valign=top>
   <td width="76" height="22" style="border-left-width: 1; border-right-style: inset; border-right-width: 1; border-top-width: 1; border-bottom-width: 1">
        <div align="right">E-post&nbsp;</div>
      </td>
      <td>
        <input type="text"  name="mail" value="" size="40">
      </td>
      </tr>
    <%end if%>
    <tr valign=top>
      <td width="76" height="45" style="border-left-width: 1; border-right-style: inset; border-right-width: 1; border-top-width: 1; border-bottom-width: 1">
        <div align="right">
         * <span lang="sv">Start</span> &nbsp;
        </div>
      </td>
      <td>år
        <input type="text" size="5" name="startar" value="<%=Year(input_datum)%>">
      mån
        <input type="text" maxlength=2 size=3 name="startmanad" value="<%=Month(input_datum)%>">
        dag
        <input type="text" maxlength=2 size=3 name="startdag" value="<%=Day(input_datum)%>">
        timme
        <input type="text" maxlength=2 size=3 name="starttimme" value="<%=DatePart("h",input_datum,0,0)%>">
        minut
        <input type="text" maxlength=2 size=3 name="startminut" value="<%=DatePart("n",input_datum,0,0)%>">
        <font color="#FF3333">&nbsp;</font> <br>
        &nbsp;</td>
    </tr>
    <tr valign=top>
      <td width="76" height="45" style="border-left-width: 1; border-right-style: inset; border-right-width: 1; border-top-width: 1; border-bottom-width: 1">
        <div align="right">
         * Slut &nbsp;
        </div>
      </td>
      <td>timme
        <input maxlength=2 size=3 name="sluttimme" value="">
        minut
        <input maxlength=2 size=3 name="slutminut" value="">
        <font color="#FF3333">&nbsp;</font> <br>
        &nbsp;</td>
    </tr>    <tr valign=top>
      <td width="77" height="26">
        <div align="right">&nbsp;</div>
      </td>
      <td>
        <input type="submit" value="Spara!" name="Submit"> <input type="reset" value="Rensa!" name="Reset"> <input type="button" value="Stäng!" onClick="javascript:window.close();"><%=UserAccount & " " & poster("anstID")%>
      </td>
    </tr>
  </table>
 </form>
</div>
<%

'START - Per Andersson TE, 2003-10-16
   else
%>
 
 <P><font face="Arial" size="2"><b>Du saknar behörighet!</b></font></P>
 
<%
   end if
%>
 

<%
'Rensa upp
poster.close
posts.close
post.close
set databas = Nothing

'SLUT - Per Andersson TE, 2003-10-16
%>

</body>
</html>
0
Comment
Question by:MaB
2 Comments
 
LVL 39

Accepted Solution

by:
appari earned 500 total points
ID: 10723265
may its becoz div tag is not closed properly?

change(the line before <form...>
<div id="div3"

to

<div id="div3">

0
 
LVL 7

Author Comment

by:MaB
ID: 10723287
Thank you sooo much.

Knowing myself I was really looking for a typo, but just couldn't find it though I've been staring at the code for hours and hours. FrontPig isn't really helping out when it comes to typos.

Thanks again, now I can focus on the update database page.

BR MaB
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help with stored procedure 30 59
XML Parsing Classic ASP 5 50
Generate report pulling data (links) from three tables 31 58
Questions about INCLUDE FILES 2 20
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now