Avatar billede martin_sj Nybegynder
28. august 2010 - 09:35

Afgræns visning

Hej Eksperter

Jeg har lavet en side i dreamweaver hvor man kan melde sig til fodbold. jeg ønsker følgende funktionalitet.
I formen hvor man melder sig til ønsker jeg at man kun kan vælge datoer der er >= dags dato. Og i listen hvor tilmeldte vises skal kun tilmeldinger vises der er >= dags dato. Jeg har kopieret koden for siden ind her, håber der er nogen der kan hjælpe.

If (CStr(Request("MM_insert")) = "form1") Then

  MM_editConnection = MM_Fodbold_STRING
  MM_editTable = "Tilmeldte"
  MM_editRedirectUrl = "tilmelding.asp"
  MM_fieldsStr  = "Tilmeldte|value|Dato|value|Kommentar|value"
  MM_columnsStr = "Tilmeldte|',none,''|Dato|',none,''|Kommentar|',none,''"

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
 
  ' set the form values
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  Next

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If

End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(Request("MM_insert")) <> "") Then

  ' create the sql insert statement
  MM_tableValues = ""
  MM_dbValues = ""
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
      MM_formVal = MM_emptyVal
    Else
      If (MM_altVal <> "") Then
        MM_formVal = MM_altVal
      ElseIf (MM_delim = "'") Then  ' escape quotes
        MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
      Else
        MM_formVal = MM_delim + MM_formVal + MM_delim
      End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
      MM_tableValues = MM_tableValues & ","
      MM_dbValues = MM_dbValues & ","
    End If
    MM_tableValues = MM_tableValues & MM_columns(MM_i)
    MM_dbValues = MM_dbValues & MM_formVal
  Next
  MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

  If (Not MM_abortEdit) Then
    ' execute the insert
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
<%
Dim Datoer
Dim Datoer_numRows

Set Datoer = Server.CreateObject("ADODB.Recordset")
Datoer.ActiveConnection = MM_Fodbold_STRING
Datoer.Source = "SELECT * FROM Datoer"
Datoer.CursorType = 0
Datoer.CursorLocation = 2
Datoer.LockType = 1
Datoer.Open()

Datoer_numRows = 0
%>
<%
Dim Tilmeld
Dim Tilmeld_numRows

Set Tilmeld = Server.CreateObject("ADODB.Recordset")
Tilmeld.ActiveConnection = MM_Fodbold_STRING
Tilmeld.Source = "SELECT * FROM Tilmeldte ORDER BY Dato ASC"
Tilmeld.CursorType = 0
Tilmeld.CursorLocation = 2
Tilmeld.LockType = 1
Tilmeld.Open()

Tilmeld_numRows = 0
%>
<%
Dim Medlemmer
Dim Medlemmer_numRows

Set Medlemmer = Server.CreateObject("ADODB.Recordset")
Medlemmer.ActiveConnection = MM_Fodbold_STRING
Medlemmer.Source = "SELECT * FROM Medlemmer ORDER BY Navn ASC"
Medlemmer.CursorType = 0
Medlemmer.CursorLocation = 2
Medlemmer.LockType = 1
Medlemmer.Open()

Medlemmer_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
Tilmeld_numRows = Tilmeld_numRows + Repeat1__numRows
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><!-- InstanceBegin template="Templates/MyTemplate.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="doctitle" -->
<title>Tilmeld</title>
<!-- InstanceEndEditable -->
<script type="text/JavaScript">
<!--
function mmLoadMenus() {
  if (window.mm_menu_0124112210_0) return;
    window.mm_menu_0124112210_0 = new Menu("root",80,18,"",12,"#000000","#FFFFFF","#CCCCCC","#000084","left","middle",3,0,1000,-5,7,true,false,true,0,true,true);
  mm_menu_0124112210_0.addMenuItem("Filmlisten","location='filmlisten.asp'");
  mm_menu_0124112210_0.addMenuItem("Filmlinks","location='filmlinks.html'");
  mm_menu_0124112210_0.hideOnMouseOut=true;
  mm_menu_0124112210_0.bgColor='#555555';
  mm_menu_0124112210_0.menuBorder=1;
  mm_menu_0124112210_0.menuLiteBgColor='#FFFFFF';
  mm_menu_0124112210_0.menuBorderBgColor='#777777';
window.mm_menu_0124112440_0 = new Menu("root",85,18,"",12,"#000000","#FFFFFF","#CCCCCC","#000084","left","middle",3,0,1000,-5,7,true,false,true,0,true,true);
  mm_menu_0124112440_0.addMenuItem("Tilmelding","location='tilmelding.asp'");
  mm_menu_0124112440_0.addMenuItem("Bestilling","location='bestilling.asp'");
  mm_menu_0124112440_0.hideOnMouseOut=true;
  mm_menu_0124112440_0.bgColor='#555555';
  mm_menu_0124112440_0.menuBorder=1;
  mm_menu_0124112440_0.menuLiteBgColor='#FFFFFF';
  mm_menu_0124112440_0.menuBorderBgColor='#777777';
window.mm_menu_0124112947_0 = new Menu("root",76,18,"",12,"#000000","#FFFFFF","#CCCCCC","#000084","left","middle",3,0,1000,-5,7,true,false,true,0,true,true);
  mm_menu_0124112947_0.addMenuItem("Puslespil","location='puslespil.html'");
  mm_menu_0124112947_0.hideOnMouseOut=true;
  mm_menu_0124112947_0.bgColor='#555555';
  mm_menu_0124112947_0.menuBorder=1;
  mm_menu_0124112947_0.menuLiteBgColor='#FFFFFF';
  mm_menu_0124112947_0.menuBorderBgColor='#777777';

mm_menu_0124112947_0.writeMenus();
} // mmLoadMenus()

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<script language="JavaScript" src="mm_menu.js"></script>
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
.style2 {color: #000000}
-->
</style>
<style type="text/css">
<!--
.style3 {color: #597786}
-->
</style>
<style type="text/css">
<!--
.style4 {color: #597786; font-weight: bold; }
-->
</style><!-- InstanceEndEditable -->
<link href="design.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
    background-image: url(Images/baggrund.gif);
}
.style1 {
    color: #FFFFFF;
    font-style: italic;
    font-size: 9pt;
}
-->
</style>
</head>

<body onLoad="MM_preloadImages('Images/btnGalleri_on.jpg','Images/btnForside_on.jpg','Images/btnTilmeld_on.jpg','Images/btnMedlemmer_on.jpg','Images/btnLinks_on.jpg')">
<script language="JavaScript1.2">mmLoadMenus();</script>
<table width="650" height="100%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#597786" bgcolor="#FFFFFF">
  <tr>
    <td height="120"><!-- InstanceBeginEditable name="Banner" --><img src="Images/Tilmeld.jpg" width="650" height="120"><!-- InstanceEndEditable --></td>
  </tr>
  <tr>
    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
     
      <tr>
        <td width="25" height="32"><img src="Images/KnapperV.jpg" width="25" height="25"></td>
        <td><a href="Forside.htm"><img src="Images/btnForside_off.jpg" name="Image1" width="120" height="25" border="0" onMouseOver="MM_swapImage('Image1','','Images/btnForside_on.jpg',1)" onMouseOut="MM_swapImgRestore()"></a><a href="tilmelding.asp"><img src="Images/btnTilmeld_off.jpg" name="Image2" width="120" height="25" border="0" onMouseOver="MM_swapImage('Image2','','Images/btnTilmeld_on.jpg',1)" onMouseOut="MM_swapImgRestore()"></a><a href="Medlemmer.asp"><img src="Images/btnMedlemmer_off.jpg" name="Image3" width="120" height="25" border="0" onMouseOver="MM_swapImage('Image3','','Images/btnMedlemmer_on.jpg',1)" onMouseOut="MM_swapImgRestore()"></a><a href="Galleri.htm"><img src="Images/btnGalleri_off.jpg" name="Image4" width="120" height="25" border="0" onMouseOver="MM_swapImage('Image4','','Images/btnGalleri_on.jpg',1)" onMouseOut="MM_swapImgRestore()"></a><a href="Links.htm"><img src="Images/btnLinks_off.jpg" name="Image5" width="120" height="25" border="0" onMouseOver="MM_swapImage('Image5','','Images/btnLinks_on.jpg',1)" onMouseOut="MM_swapImgRestore()"></a></td>
        <td width="25"><div align="left"><img src="Images/KnapperH.jpg" width="25" height="25"></div></td>
      </tr>
      <tr>
        <td width="25" height="25">&nbsp;</td>
        <td height="25"><p>&nbsp;</p>          </td>
        <td width="25" height="25">&nbsp;</td>
      </tr>
      <tr>
        <td width="25">&nbsp;</td>
        <td><!-- InstanceBeginEditable name="Indhold" -->
          <h1 class="style2"><span class="style3">Tilmelding/Afmelding</span></h1>
          <form name="form1" method="POST" action="<%=MM_editAction%>">
            <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
              <tr>
                <th width="5" scope="col">&nbsp;</th>
                <th width="180" scope="col"><div align="center">Medlem
                    <select name="Tilmeldte" id="Tilmeldte">
                      <%
While (NOT Medlemmer.EOF)
%>
                      <option value="<%=(Medlemmer.Fields.Item("Navn").Value)%>"><%=(Medlemmer.Fields.Item("Navn").Value)%></option>
                      <%
  Medlemmer.MoveNext()
Wend
If (Medlemmer.CursorType > 0) Then
  Medlemmer.MoveFirst
Else
  Medlemmer.Requery
End If
%>
                    </select>
                </div></th>
                <th width="100" scope="col"><div align="center">Dato
                    <select name="Dato" id="Dato">
                      <%
While (NOT Datoer.EOF)
%><option value="<%=(Datoer.Fields.Item("Dato").Value)%>"><%=(Datoer.Fields.Item("Dato").Value)%></option>
                      <%
  Datoer.MoveNext()
Wend
If (Datoer.CursorType > 0) Then
  Datoer.MoveFirst
Else
  Datoer.Requery
End If
%>
                    </select>
                </div></th>
                <th width="280" scope="col"><div align="center">Kommentar
                  <input name="Kommentar" type="text" id="Kommentar" size="35">
                </div></th>
                <th width="40" valign="bottom" scope="col"><div align="center">
                  <input name="Submit" type="submit" value="Tilmeld">
                </div></th><th width="5" scope="col">&nbsp;</th>
              </tr>
            </table>
         
                        <input type="hidden" name="MM_insert" value="form1">
          </form>
          <p class="style4">Tilmeldinger/Afmeldinger</p>
         
         
            <form name="form2">
              <table width="100%" border="1" cellpadding="0" cellspacing="0" bgcolor="#B9C9D0">
                <tr>
                  <th width="100" scope="col">Dato</th>
                  <th width="200" scope="col">Medlem</th>
                  <th width="300" scope="col">Kommentar</th>
                </tr>
                <%
While ((Repeat1__numRows <> 0) AND (NOT Tilmeld.EOF))
%>
                  <tr>
                    <td width="100"><div align="center"><%=(Tilmeld.Fields.Item("Dato").Value)%> </div></td>
                    <td width="200"><div align="center"><%=(Tilmeld.Fields.Item("Tilmeldte").Value)%></div></td>
                    <td width="300"><div align="center"><%=(Tilmeld.Fields.Item("Kommentar").Value)%></div></td>
                  </tr>
                  <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Tilmeld.MoveNext()
Wend
%>
              </table>
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester