33 messaggi dal 12 aprile 2006
il codice attuale :

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/sociSSS.asp" -->
<%
// *** Edit Operations: declare variables

// set the form action variable
var MM_editAction = Request.ServerVariables("SCRIPT_NAME");
if (Request.QueryString) {
  MM_editAction += "?" + Server.HTMLEncode(Request.QueryString);
}

// boolean to abort record edit
var MM_abortEdit = false;
%>
<%
if (String(Request("MM_update")) == "eventi") {
  if (!MM_abortEdit) {
    // execute the update
  
    var MM_editCmd = Server.CreateObject ("ADODB.Command");
    MM_editCmd.ActiveConnection = MM_sociSSS_STRING;
    MM_editCmd.CommandText = "UPDATE picchietti SET pilota = ?, sub1 = ?, sub2 = ?, os1 = ?, os2 = ? WHERE Contatore = ?";
    MM_editCmd.Prepared = true;
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param1", 202, 1, 255, Request.Form("pilota"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param2", 202, 1, 255, Request.Form("sub1"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param3", 202, 1, 255, Request.Form("sub2"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param4", 202, 1, 255, Request.Form("os1"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param5", 202, 1, 255, Request.Form("os2"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param6", 5, 1, -1, (String(Request.Form("MM_recordId")) != "undefined" && String(Request.Form("MM_recordId")) != "") ? Request.Form("MM_recordId") : null)); // adDouble
    MM_editCmd.Execute();
    MM_editCmd.ActiveConnection.Close();

    // append the query string to the redirect URL
    var MM_editRedirectUrl = "1001_iscrizione_eventi.asp";
    if (MM_editRedirectUrl && Request.QueryString && Request.QueryString.Count > 0) {
      MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1) ? "?" : "&") + Request.QueryString;
    }
    Response.Redirect(MM_editRedirectUrl)
  }
}
%>
<%
Session.LCID = 1040
%>
<%
var Elenco_cmd = Server.CreateObject ("ADODB.Command");
Elenco_cmd.ActiveConnection = MM_sociSSS_STRING;
Elenco_cmd.CommandText = "SELECT * FROM picchietti ORDER BY Contatore";
Elenco_cmd.Prepared = true;

var Elenco = Elenco_cmd.Execute();
var Elenco_numRows = 0;
%>
<%
var Repeat1__numRows = -1;
var Repeat1__index = 0;
Elenco_numRows += Repeat1__numRows;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>tabella</title>
</head>

<body>
<table width="900" height="580" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td><table width="860" height="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td id="content_box" align="left" valign="top">
                            <span id="titolo_sezione" class="titolobig">Tabella eventi : </span><span class="commentoobliquo"> </span><br />
                            <br />
                            
                              <table width="860" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td width="80" align="center" valign="middle"><span class="postit3">Data</span></td>
      <td width="100" align="center" valign="middle"><span class="postit3">Pilota</span></td>
      <td width="120" align="center" valign="middle"><span class="postit3">Sub 1</span></td>
      <td width="120" align="center" valign="middle"><span class="postit3">Sub 2</span></td>
      <td width="120" align="center" valign="middle"><span class="postit3">OS 1</span></td>
      <td width="120" align="center" valign="middle"><span class="postit3">OS 2</span></td>
      <td width="120" align="center" valign="middle">&nbsp;</td>
    </tr>
                                                          </table>
                              <% while ((Repeat1__numRows-- != 0) && (!Elenco.EOF)) { %>
                                <form ACTION="<%=MM_editAction%>" METHOD="POST" name="eventi" id="eventi">
                                  <table width="860" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                      <td colspan="7" align="center" valign="middle"><table width="860" border="0" align="center" cellpadding="3" cellspacing="0">
          <tr>
            <td width="80" align="center" valign="middle" class="postitBigtitnero"><%=(Elenco.Fields.Item("dataevento").Value)%></td>
            <td width="100" align="center" valign="middle" class="commentored4">
            <label>
              <input name="pilota" type="text" id="pilota" value="<%=(Elenco.Fields.Item("pilota").Value)%>" size="16" />
            </label></td>
            <td width="120" align="center" valign="middle"><label>
              <input name="sub1" type="text" id="sub1" value="<%=(Elenco.Fields.Item("sub1").Value)%>" size="16" />
            </label></td>
            <td width="120" align="center" valign="middle"><input name="sub2" type="text" id="sub2" value="<%=(Elenco.Fields.Item("sub2").Value)%>" size="16" /></td>
            <td width="120" align="center" valign="middle"><label>
              <input name="os1" type="text" id="os1" value="<%=(Elenco.Fields.Item("os1").Value)%>" size="16" />
            </label></td>
            <td width="120" align="center" valign="middle"><label>
              <input name="os2" type="text" id="os2" value="<%=(Elenco.Fields.Item("os2").Value)%>" size="16" />
            </label></td>
            <td width="120" align="right" valign="middle"><label>
              <input type="submit" name="aggiorna" id="aggiorna" value="Salva presenza" />
            </label></td>
          </tr>
                                        
        </table></td>
        </tr>
                                  </table>
                                  <table width="860" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                      <td width="860"><table width="860" border="0" cellspacing="5" cellpadding="0">
                                       
                                      </table></td>
      </tr>
                                    <tr>
                                      <td><img src="img/spacer_trasp.gif" width="1" height="5" /></td>
      </tr>
                                  </table>
                                  <input type="hidden" name="MM_update" value="eventi" />
                                  <input type="hidden" name="MM_recordId" value="<%= Elenco.Fields.Item("Contatore").Value %>" />
                              </form>
                                <%
  Repeat1__index++;
  Elenco.MoveNext();
}
%></td>
                    </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
<%
Elenco.Close();
%>
11.886 messaggi dal 09 febbraio 2002
Contributi
Ciao Jean,
eccomi, non avevo realizzato che stavi usando il linguaggio JScript. L'esempio di codice che ti ho fornito io era in VbScript. Prova così.

<td width="120" align="center" valign="middle">
<%
if (picchetti.Fields.Item("sub1").Value == "") {
  Response.Write("<input type=\"text\" name=\"sub1\" value=\"\" />");
} else {
  Response.Write(picchetti.Fields.Item("sub1").Value);
}
%>
</td>

Enjoy learning and just keep making

Torna al forum | Feed RSS

ASPItalia.com non è responsabile per il contenuto dei messaggi presenti su questo servizio, non avendo nessun controllo sui messaggi postati nei propri forum, che rappresentano l'espressione del pensiero degli autori.