Tilsyneladen blev mit spørgsmåæ misforstået lidt.
Når en bruger skal oprettet/rettet en ny post, vil nedenstående åbne et
vindue (virker)
Her er koden der åbner vinduet
function nyramme(nul){
window.open
("edit.asp?mode=newsubjekt","firma","dependent=yes,width=600,height=450,loca
tion=no,scrollbars=yes");
Bruger indtaster så sine "ting" og sender formen afsted. (Hvilken er
rekusivt, idet at det er den samme side der bliver kaldt.)(virker)
Data bliver gemt i databasen (Virker)
Her kommer problemet så. Jeg vil gerne have "moder vinduet" til at refreshe
for herefter at lukke popup-vinduet (virker sådan set også, men modervinduet
bliver ikke refreshet)
Håber at der er en der kan hjælpe
Og her er vinduet:
<%@LCID=1030%>
<% 'Opret databaseobjekt
set conn = Server.CreateObject("ADODB.Connection")
'Åben forbindelsen til databasen
'conn.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
request.servervariables ("appl_physical_path") &
"informatikstøtte\publikation\rm\ret\rammeaftale.mdb"
conn.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
request.servervariables ("appl_physical_path") & "database\rammeaftale.mdb"
'Er der noget resultat i HTTP-protokollen, hvis ja, udfør script
if Request.ServerVariables ("CONTENT_LENGTH") > 0 then
if Request.QueryString ("mode") = "opret" then
' Opbyg SQL-streng
sql = "Insert into ramaft (sapnr, ramnr, fnavn, adr, pnr, byen, tlf,
vkat, idato,"
sql = sql & " udato, oms1, oms2, link, bem, status) values ('" &
request.form("sapnr")
sql = sql & "','" & request.form("ramnr") & "','" & request.form("fnavn")
sql = sql & "','" & request.form("adr") & "','" & request.form("pnr")
sql = sql & "','" & request.form("bye") & "','" & request.form("tlf")
sql = sql & "','" & request.form("vkat") & "','" & request.form("idato")
sql = sql & "','" & request.form("udato") & "','" & request.form("oms1")
sql = sql & "','" & request.form("oms2") & "','" & request.form("lnk")
sql = sql & "','" & replace(request.form("bem"), vbcrlf, "<br>" & vbcrlf)
sql = sql & "','" & request.form("status") & "')"
'Udfør SQL-streng
conn.execute(sql)
'Bruger tilbage til oversigt
tilbage = true
end if
if Request.QueryString ("mode") = "retpost" then
'Opbyg SQL-streng
sql = "Update ramaft set sapnr='" & Request.form ("sapnr") & "', ramnr='"
& Request.form ("ramnr")
sql = sql & "', fnavn='" & Request.form ("fnavn") & "', adr='" &
Request.form ("adr")
sql = sql & "', pnr='" & Request.form ("pnr") & "', byen='" &
Request.form ("bye")
sql = sql & "', tlf='" & Request.form ("tlf") & "', vkat='" &
Request.form ("vkat")
sql = sql & "', Idato='" & Request.form ("idato") & "', Udato='" &
Request.form ("udato")
sql = sql & "', oms1='" & Request.form ("oms1") & "', oms2='" &
Request.form ("oms2")
sql = sql & "', link='" & Request.form ("lnk") & "', bem='" &
Request.form ("bem")
sql = sql & "' ,status='" & Request.form ("status") & "' where id = " &
Request.QueryString ("id")
'sql = sql & "' where id = " & cint(Request.QueryString ("id"))
'Udfør SQL-streng
conn.execute(sql)
'Bruger tilbage til oversigt
tilbage=true
end if
end if
if Request.QueryString ("mode") = "retpost" then
sql = "select * from ramaft where id=" & Request.QueryString ("id")
set ValgRs = conn.execute (sql)
end if
%>
<html>
<head>
<title>edit.asp</title>
<link rel='stylesheet' type='text/css' href='stylesheet/test.css'>
</head>
<body <%if tilbage= true then Response.Write (" onload='window.close()'")%>>
<p align="center"><strong><font class="main">
<% If Request.QueryString ("mode") = "newsubjekt" then
Response.Write ("Opret ny rammeaftale")
else
Response.Write ("Rediger post (vis hvilken post)")
end if
%>
<form action="
<% If Request.QueryString ("mode") = "newsubjekt" then
Response.Write ("edit.asp?mode=opret")
else
Response.Write ("edit.asp?mode=retpost&id=" & Request.QueryString ("id"))
end if
%>" method="post">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse:
collapse" bordercolor="#111111" width="100%" height="355" >
<tr><td width="22%" height="19">SAPnr</td>
<td width="78%" height="19">
<input type="text" name="sapnr" maxlength="10" size="10" <%if
Request.QueryString ("mode") = "retpost" then Response.Write ("value='" &
valgrs("sapnr") & "'")%>>
</td>
</tr>
<tr><td width="22%" height="19">RAMnr</td>
<td width="78%" height="19">
<input type="text" name="ramnr" maxlength="10" size="10" <%if
Request.QueryString ("mode") = "retpost" then Response.Write ("value='" &
valgrs("ramnr") & "'")%>>
</td>
</tr>
<tr><td width="22%" height="19">Firmanavn</td>
<td width="78%" height="19">
<input type="text" name="fnavn" maxlength="50" size="50" <%if
Request.QueryString ("mode") = "retpost" then Response.Write ("value='" &
valgrs("fnavn") & "'")%>>
</td>
</tr>
<tr><td width="22%" height="19">Adresse</td>
<td width="78%" height="19">
<input type="text" name="adr" maxlength="50" size="50" <%if
Request.QueryString ("mode") = "retpost" then Response.Write ("value='" &
valgrs("adr") & "'")%>>
</td>
</tr>
<tr><td width="22%" height="19">Postnumre</td>
<td width="78%" height="19">
<input type="text" name="pnr" maxlength="4" size="4" <%if
Request.QueryString ("mode") = "retpost" then Response.Write ("value='" &
valgrs("pnr") & "'")%>>
</td>
</tr>
<tr><td width="22%" height="19">By</td>
<td width="78%" height="19">
<input type="text" name="bye" maxlength="50" size="50" <%if
Request.QueryString ("mode") = "retpost" then Response.Write ("value='" &
valgrs("byen") & "'")%>>
</td>
</tr>
<tr><td width="22%" height="19">Telefon</td>
<td width="78%" height="19">
<input type="text" name="tlf" maxlength="8" size="8" <%if
Request.QueryString ("mode") = "retpost" then Response.Write ("value='" &
valgrs("tlf") & "'")%>>
</td>
</tr>
<tr><td width="22%" height="19">Varekategori</td>
<td width="78%" height="19">
<input type="text" name="vkat" size="20" <%if Request.QueryString
("mode") = "retpost" then Response.Write ("value='" & valgrs("vkat") &
"'")%>>
</td>
</tr>
<tr><td width="22%" height="19">Indgåelsesdato</td>
<td width="78%" height="19">
<input type="text" name="idato" size="20" <%if Request.QueryString
("mode") = "retpost" then Response.Write ("value='" & valgrs("idato") &
"'")%>>
</td>
</tr>
<tr><td width="22%" height="19">Udløbsdato</td>
<td width="78%" height="19">
<input type="text" name="udato" size="20" <%if Request.QueryString
("mode") = "retpost" then Response.Write ("value='" & valgrs("udato") &
"'")%>>
</td>
</tr>
<tr><td width="22%" height="19">Omsætning 1</td>
<td width="78%" height="19">
<input type="text" name="oms1" size="20" <%if Request.QueryString
("mode") = "retpost" then Response.Write ("value='" & valgrs("oms1") &
"'")%>>
</td>
</tr>
<tr><td width="22%" height="19">Omsætning 2</td>
<td width="78%" height="19">
<input type="text" name="oms2" size="20" <%if Request.QueryString
("mode") = "retpost" then Response.Write ("value='" & valgrs("oms2") &
"'")%>><br>
</td>
</tr>
<tr><td width="22%" height="19">Link</td>
<td width="78%" height="19">
<input type="text" name="lnk" size="20" <%if Request.QueryString
("mode") = "retpost" then Response.Write ("value='" & valgrs("link") &
"'")%>>
</td>
</tr>
<tr><td width="22%" height="53">Bemærkning</td>
<td width="78%" height="53">
<textarea rows="3" cols="50" name="bem"><%if Request.QueryString
("mode") = "retpost" then Response.Write (valgrs("bem"))%>
</textarea></td>
</tr>
<tr><td width="22%" height="19">Synlig</td>
<td width="78%" height="19"><select size="1" name="status">
<option
<% if Request.QueryString ("mode") = "retpost" then
if valgrs("status") = "Ja" then Response.Write (" selected ")
end if%> value="Ja">Ja</option>
<option
<% if Request.QueryString ("mode") = "retpost" then
if valgrs("status") = "Nej" then Response.Write (" selected ")
end if%> value="Nej">Nej</option>
</select></td>
</tr>
<tr><td width="22%" height="21"><input type="submit" name="submit"
value="Send!"></td>
<td width="78%" height="21"></td>
</tr>
</table>
</form>
</body>
</html>
|