Trucsweb.com

Forum de discussion

 Forum « Programmation ASP » (archives)

<br> dans un form de mise à jour

Envoyé: 25 octobre 2003, 11h41 par PJM


J’ai réalisé des formulaires de mise à jour ou de modification de ma base de données
J’ai un petit problème…
Quand je valide mes saisies le formulaire ne prend pas en compte les <br>
Je l’ai pourtant intégré dans : FormVal = replace(FormVal, vbcrlf, "<br>")

ci-joint le code

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/Pycna.asp" -->
<%
' *** Edit Operations: declare variables

MM_editAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables

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

MM_editConnection = MM_Pycna_STRING
MM_editTable = "T_Actualites"
MM_editRedirectUrl = "Liste_Actu.asp"
MM_fieldsStr = "Tri|value|DateActu|value|Type|value|Titre|value|STitre|value|Resum|value|Desc1|value|Desc2|value|Ph1|value|Ph2|value"
MM_columnsStr = "Ordre_de_tri|',none,''|Publication|',none,''|Type|',none,''|Titre|',none,''|Sous_titre|',none,''|Resume|',none,''|Descriptif_1|',none,''|Descriptif_2|',none,''|Photo_1|',none,''|Photo_2|',none,''"

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")

' set the form values
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(i+1) = CStr(Request.Form(MM_fields(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

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

' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
FormVal = MM_fields(i+1)
MM_typeArray = Split(MM_columns(i+1),",")
Delim = MM_typeArray(0)
If (Delim = "none") Then Delim = ""
AltVal = MM_typeArray(1)
If (AltVal = "none") Then AltVal = ""
EmptyVal = MM_typeArray(2)
If (EmptyVal = "none") Then EmptyVal = ""
If (FormVal = "") Then
FormVal = EmptyVal
Else
If (AltVal <> "") Then
FormVal = AltVal
ElseIf (Delim = "'") Then ' escape quotes
FormVal = "'" & Replace(FormVal,"'","''") & "'"
Else
FormVal = Delim + FormVal + Delim
End If
If MM_columns(i)="Desc1" Then
FormVal = replace(FormVal, vbcrlf, "<br>")
End If
End If
If (i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End if
MM_tableValues = MM_tableValues & MM_columns(i)
MM_dbValues = MM_dbValues & 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
%>
<html>
<head>
<title>Création d'un enregistrement</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="styles.css" type="text/css">
</head>
<body bgcolor="#d7c49a" leftmargin="0" topmargin="4" marginwidth="0" marginheight="0">
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="MAJActu">
<table height=427 cellspacing=0 cellpadding=0 width=770 align=center border=0>
<tbody>
<tr>
<td valign=top height=2><img height=1 src="Images/spacer.gif" width=305
border=0></td>
<td valign=top height=2><img height=1 src="Images/spacer.gif" width=465
border=0></td>
<td height=2><img height=1 src="Images/spacer.gif" width=1 border=0></td>
</tr>
<tr>
<td valign=top><img height=90 src="Images/Formulaire_r1_c1.jpg" width=305
border=0 name=Formulaire_r1_c1></td>
<td valign=top align=middle width=465 background=Images/Formulaire_r1_c2.jpg>
<p> </p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" color=#000000
size=3><b>Création d'un enregistrement<br>
Rubrique "Actualités"</b></font></p>
</td>
<td height="27"><img height=90 src="Images/spacer.gif" width=1 border=0></td>
</tr>
<tr>
<td valign=top background=Images/Formulaire_r2_c1.jpg colspan=2>
<table height=294 cellspacing=0 cellpadding=0 width="100%"
border=0>
<tbody>
<tr>
<td width="15%"> </td>
<td valign=top width="85%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="15%" valign="top"> </td>
<td width="24%" valign="top"> </td>
<td width="22%" valign="top"><font size="1"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Ordre
de tri</font></b></font></td>
<td width="39%" valign="top">
<input type="text" name="Tri" class="formbleu">
</td>
</tr>
<tr>
<td width="15%" valign="top"><font size="1"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Date</font></b></font></td>
<td width="24%" valign="top">
<input type="text" name="DateActu" class="formbleu">
</td>
<td width="22%" valign="top"><font size="1"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Type
d'actualite</font></b></font></td>
<td width="39%" valign="top">
<input type="text" name="Type" class="formbleu">
</td>
</tr>
<tr>
<td width="15%" valign="top"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Titre</font></b></td>
<td colspan="3" valign="top">
<input type="text" name="Titre" size="81" class="formbleu">
</td>
</tr>
<tr>
<td width="15%" valign="top"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Sous
titre</font></b></td>
<td colspan="3" valign="top">
<input type="text" name="STitre" size="81" class="formbleu">
</td>
</tr>
<tr>
<td width="15%" height="95" valign="top"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Résumé</font></b></td>
<td colspan="3" height="95" valign="top">
<textarea name="Resum" cols="80" rows="3" class="formbleu"></textarea>
</td>
</tr>
<tr>
<td width="15%" height="95" valign="top"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Descriptif
1</font></b></td>
<td colspan="3" height="95" valign="top">
<textarea name="Desc1" cols="80" rows="6" class="formbleu"></textarea>
</td>
</tr>
<tr>
<td width="15%" height="92" valign="top"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Descriptif
2</font></b></td>
<td colspan="3" height="92" valign="top">
<textarea name="Desc2" cols="80" rows="6" class="formbleu"></textarea>
</td>
</tr>
<tr>
<td colspan="4" height="2" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="18%"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Photo
1</font></b></td>
<td width="30%">
<input type="text" name="Ph1" class="formbleu" size="30">
</td>
<td width="13%"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Photo
2</font></b> </td>
<td width="41%">
<input type="text" name="Ph2" class="formbleu" size="30">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="4" valign="top" height="10">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td width="18%"><a href="Liste_Actu.asp" class="liennoir">Retour
à la liste</a></td>
<td width="65%" align="right" class="txt">Valider l'enregistrement
</td>
<td width="17%" valign="bottom">
<input type="image" border="0" name="imageField2" src="../Images/Ajout2.gif" width="23" height="25">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</td>
<td><img height=295 src="Images/spacer.gif" width=1
border=0></td>
</tr>
</tbody>
</table>
<input type="hidden" name="MM_insert" value="true">
</form>
</body>
</html>

Merci d’avance de ton aide ...
JMP


Réponses

 sp spRe: <br> dans un form de mise à jour Oznog31/10/2003
Aucun médias sociaux
X

Trucsweb.com Connexion

Connexion

X

Trucsweb.com Mot de passe perdu

Connexion

X

Trucsweb.com Conditions générales

Conditions

Responsabilité

La responsabilité des Trucsweb.com ne pourra être engagée en cas de faits indépendants de sa volonté. Les informations mises à disposition sur ce site le sont uniquement à titre purement informatif et ne sauraient constituer en aucun cas un conseil ou une recommandation de quelque nature que ce soit.

Aucun contrôle n'est exercé sur les références et ressources externes, l'utilisateur reconnaît que les Trucsweb.com n'assume aucune responsabilité relative à la mise à disposition de ces ressources, et ne peut être tenue responsable quant à leur contenu.

Droit applicable et juridiction compétente

Les règles en matière de droit, applicables aux contenus et aux transmissions de données sur et autour du site, sont déterminées par la loi canadienne. En cas de litige, n'ayant pu faire l'objet d'un accord à l'amiable, seuls les tribunaux canadien sont compétents.

X

Trucsweb.com Trucsweb

X

Trucsweb.com Glossaire

X

Trucsweb.com Trucsweb

X

Trucsweb.com Trucsweb

Conditions

Aucun message!

Merci.

X
Aucun message!
X

Trucsweb.com Créer un compte

Créer un compte

.
@