Salve a tutti, ho un problema con la mia applicazione, vengo subito al sodo:
Ho un database con campi che possono essere valorizzati o non.(tranne il primo quartetto.)
DN1;
PHONES1;
ORGANIZATION1;
DESCRIPTION1;
DN2;
PHONES2;
ORGANIZATION2;
DESCRIPTION2;
DN2;
PHONES2;
ORGANIZATION2;
DESCRIPTION2;
E così via fino a 20.
ASP: Ho una pagina con una tabella dinamica bla..bla..bla..(addrow)+1)che aggiunge una riga alla tabella. in modo che i campi assumano il valore uguale a quello del db
La query di inserimento va a buon fine. E fin qui ok.
Se volessi fare una pagina di select dove costruisco una tabella con solo i campi valorizzati e non tutti e 20?
Tipo che se la mia select prevedete un record con valorizzati solo 3 "quartetti" voglio che venga creata una tabella con i valori.
Grazie mille!!!
Allego un po di codice per le vostre verifiche:
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/agenzie.css">
</head>
<body>
<script>
function GetSelectValue(val)
{
var Selagenzia=document.getElementById('agenzia').Valu e;
document.location.href="index.asp?selezione=1&agen zia=" + val
}
function checkform (form)
{
if(form1.Account_Name.value==""){
alert ("Nome accout non valido");
form.Account_Name.focus();
return false;
}
return true;
}
function addRowToTable()
{
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
// if there's no header row in the table, then iteration = lastRow + 1
var iteration = lastRow;
var row = tbl.insertRow(lastRow);
// Numero Celle
var cellLeft = row.insertCell(0);
var textNode = document.createTextNode(iteration);
cellLeft.appendChild(textNode);
// Prima Cella
var cellRight = row.insertCell(1);
var el = document.createElement('input');
el.type = 'text';
el.name = 'dn' + iteration;
el.id = 'dn' + iteration;
el.size = 40;
cellRight.appendChild(el);
// Area di testo
var cellarea = row.insertCell(2);
var cl = document.createElement('TEXTAREA');
cl.name = 'description' + iteration;
cl.id = 'description' + iteration;
cellarea.appendChild(cl);
// penultima cell
var cellultima = row.insertCell(3);
var al = document.createElement('input');
al.type = 'text';
al.name = 'organization' + iteration;
al.id = 'organization' + iteration;
al.size = 20;
cellultima.appendChild(al);
// ultima cell
var cellucalco = row.insertCell(4);
var bl = document.createElement('input');
bl.type = 'text';
bl.name = 'phone' + iteration;
bl.id = 'phone' + iteration;
bl.size = 20;
cellucalco.appendChild(bl);
}
function removeRowFromTable()
{
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}
</script>
<%
openCN
dim qyeryA
dim queryB
dim sqlIns
dim queryC
'if Request.QueryString("selezione")=1 then
'queryA = "SELECT * FROM EMPLOYEES1 where agenzia = "
'queryB = request.QueryString("agenzia")
'sqlIns = queryA &queryB
'set ru = rs.Execute(sqlIns)
'end if
queryC = "SELECT * FROM EMPLOYEES where USERID = 413"
set rc = rs.Execute(queryC)
'response.Write
%>
<table align="center" cellspacing="0" cellpadding="0" width="900">
<tr valign="middle" height="25">
<td colspan="2" align="center" style="background-color: #c9d4dc; border-top: 1px solid; border-bottom: 1px solid; border-right: 1px solid; border-left: 1px solid; border-color: #6a7c8d">
<font size="3">ADInsert</font>
</td>
</tr>
<tr height="50">
<td align="center" valign="middle" style="border-right: 1px solid; border-bottom: 1px solid; border-left: 1px solid; border-color: #6a7c8d">
<form method="post" action="index.asp?ingresso=1" id=form1 name=form1 onSubmit="return checkform(this);">
<table width="294" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="284">
<table>
<tr>
<td>
<input type="text" name="Account_Name" value="<%=rc("Account_Name")%>">
Lastname
<input type="text" name="Home_Path" value="<%=rc("Home_Path")%>">
Fisrt Name
<input type="text" name="Smtp_Address" value="<%=rc("Smtp_Address")%>">
Phones
<input type="text" name="Agenzia" value="<%=rc("Agenzia")%>">
Agenzia
<input type="submit" name="Submit" value="Invia">
<input type="button" name="Submit" value="Aggiungi" onClick="addRowToTable()">
<input type="button" name="Submit" value="Rimuovi" onClick="removeRowFromTable()">
</td>
</table>
<table style="border-right: 1px solid; border-bottom: 1px solid; border-left: 1px solid; border-top: 1px solid;border-color: #6a7c8d; " id="tblSample">
<tr>
<th bgcolor="#C9D4DC"></th>
<td bgcolor="#C9D4DC"><div align="center">DN</div></td>
<td bgcolor="#C9D4DC"><div align="center">Description</div></td>
<td bgcolor="#C9D4DC"><div align="center">Oraginization</div></td>
<td bgcolor="#C9D4DC"><div align="center">Phone</div></td>
</tr>
<tr>
<% do while not (rc.eof)%>
<td>1</td>
<td><input type="text" name="dn1" id="dn1" size="40" value="<%=rc("dn")+i%>"></td>
<td><textarea name="description1" id="description1"><%=rc("description")+i%></textarea></td>
<td><input name="organization1" type="text" id="organization1" value="<%=rc("organization")+i%>"></td>
<td><input name="phone1" type="text" id="phone1" value="<%=rc("phone")+i%>"></td>
</tr>
<% rc.movenext
loop
%>
</table>
</td>
</tr>
</table>
</form>
</td>
</table>
<%
closeCN
set rp = Nothing
%>
</body>
</html>

Rispondi quotando
