Compilare PDF da form attraverso asp
nota bene: lo script nella versione "copia e incolla" che segue, presuppone permessi di scrittura lato server .. in paritcolare, è la root o cartella di destinazione del nuovo documento PDF che deve possedere i permessi di scrittura [chmod "666" - "777"] ..e l' utilizzo è di assoluta facilità: copia inclolla e salva come *.asp
CODICE:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!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=utf-8" />
<title>Compilare PDF da form</title>
<style type="text/css">
<!--
.style1 {
font-family: Arial, Helvetica, sans-serif;
color: #333333;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' deve contenere un numeror.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' necessario.\n'; }
} if (errors) alert('Attenzione errore:\n'+errors);
document.MM_returnValue = (errors == '');
} }
//-->
</script>
</head>
<body>
<form action="form2.asp" method="post" name="form1" target="_self" id="form1">
<p>
<label><span class="style1">nome
<input type="text" name="nome" id="nome" />
</span></label>
*</p>
<p class="style1">
<label>cognome
<input type="text" name="cognome" id="cognome" />
</label>
*</p>
<p class="style1">
<label>numero previdenza
<input type="text" name="numeroprevidenza" id="numeroprevidenza" />
</label>
*</p>
<p class="style1">
<label>indirizzo
<input type="text" name="indirizzo" id="indirizzo" />
</label>
*</p>
<p class="style1">
<label>citta'
<input type="text" name="citta" id="citta" />
</label>
*</p>
<p class="style1">
<label>tasse
<input name="tasse" type="text" id="tasse" value="1512" />
</label>
<label>dec
<input name="decimali" type="text" id="decimali" value="00" size="5" maxlength="2" />
</label>
</p>
<p> </p>
<p>
<input name="button" type="submit" id="button" onclick="MM_validateForm('nome','','R','cognome','','R','numeroprevidenza','','R','indirizzo','','R','citta','','R',
'tasse','','RisNum','decimali','','R');return document.MM_returnValue" value="Compila PDF" />
</p>
<p> </p>
<p> </p>
<p> </p>
</form>
</body>
</html>
|