Solved

Submit button and reset button don't work

Posted on 2004-03-31
2
1,109 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 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

12 Experts available now in Live!

Get 1:1 Help Now