?
Solved

Submit button and reset button don't work

Posted on 2004-03-31
2
Medium Priority
?
1,121 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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
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/…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

770 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