<%@ Language=VBScript %>
<%
Option Explicit
Response.Expires = 0
On Error Resume Next
Dim strbtnlblsubmit, strfield
strbtnlblsubmit = "Abschicken"
Function funvarif(ByVal blncondition, ByVal varthenpart, ByVal varelsepart)
If blncondition Then
funvarif = varthenpart
Else
funvarif = varelsepart
End if
End Function
%>
<!--#include virtual="asppages/silvi/_include/preheader.inc" -->
<html>
<head>
<title>ASP Formularverarbeitung: Typen von Formularfeldern und ihre Verarbeitung
</title>
<!--#include virtual="asppages/silvi/_include/header.inc" -->
</head>
<body>
<%
If Request.Form("btnsubmit") = strbtnlblsubmit Then
Response.Write("<h2>Ihre Eingaben</h2>"&vbCRLf)
Response.Write("Textfeld: "&Request.Form("frmfldtext")&"<p />")
For Each strfield In Request.Form("frmflddropdown")
Response.Write("Dropdown mehrfach: "&strfield&"<br />")
Next
Response.Write("<br />")
Response.Write("Dropdown einfach: "&request.form("frmflddropdownohne")&"<p />")
Response.Write("Optionsfeld: "&request.form("frmfldoption")&"<br />")
Response.Write("Kontrollfeld: "&request.form("frmfldcheckbox")&"<br />")
Response.Write("Verstecktes Feld: "&request.form("frmfldhidden")&"<br />")
End If
%>
<h2>Formular
</h2>
<form method="post" action="030formularmitasp.asp">
<p>Text
<input type="text" name="frmfldtext" size="20" value="<%
=Request.Form("frmfldtext")%>" /></p>
<p>Dropdown mit Mehrfachauswahl
</p>
<p>
<select size="3" name="frmflddropdown" multiple="">
<option value="1" <%
Response.Write(funvarif(InStr(Request.Form("frmflddropdown"),"1")>0,_
" selected=""""",""))%>>Auswahl 1
</option>
<option value="2" <%
Response.Write(funvarif(InStr(Request.Form("frmflddropdown"),"2")>0,_
" selected=""""",""))%>>Auswahl 2
</option>
<option value="3" <%
Response.Write(funvarif(InStr(Request.Form("frmflddropdown"),"3")>0,_
" selected=""""",""))%>>Auswahl 3
</option>
</select>
</p>
<p>Dropdown ohne Mehrfachauswahl
</p>
<p>
<select size="1" name="frmflddropdownohne">
<option value="1" <%
Response.Write(funvarif(Request.Form("frmflddropdownohne") = 1,_
" selected=""""",""))%>>Auswahl 1
</option>
<option value="2" <%
Response.Write(funvarif(Request.Form("frmflddropdownohne") = 2,_
" selected=""""",""))%>>Auswahl 2
</option>
<option value="3" <%
Response.Write(funvarif(Request.Form("frmflddropdownohne") = 3,_
" selected=""""",""))%>>Auswahl 3
</option>
</select>
</p>
<p><input type="radio" name="frmfldoption" value="A" / <%
Response.Write(funvarif(Request.Form("frmfldoption") = "A",_
" checked=""""",""))%> />A
<input type="radio" name="frmfldoption" value="B" / <%
Response.Write(funvarif(Request.Form("frmfldoption") = "B",_
" checked=""""",""))%> />B
</p>
<p>
<input type="checkbox" name="frmfldcheckbox" value="angekreuzt" / <%
Response.Write(funvarif(Request.Form("frmfldcheckbox") = "angekreuzt",_
" checked=""""",""))%> />Kontrollkästchen
</p>
<p>
<input type="hidden" name="frmfldhidden" value="<%
Response.Write(Request.Cookies("Name"))%>" />Verstecktes Feld
</p>
<p><input type="submit" name="btnsubmit" value="<%=strbtnlblsubmit%>" /></p>
</form>
<!--#include virtual="asppages/silvi/_include/inchtmlnachspann.asp" -->
</body>
</html>
Demo: beispiele/030formularmitasp.asp
Letzter Update:
26.12.2021 16:48
Zurück zur
Liste mit ASP-Beispielen auf
www.ecotronics.ch