Solved

Submit button and reset button don't work

Posted on 2004-03-31
2
1,117 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

689 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