8796 sujets

Développement web côté serveur, CMS

Bonjour,

J'ai un formulaire assez complexe et j'aimerais que ma page d'envois affiche un message si un champs n'est pas remplis (opu est invalide).

Voici une partie de ma page d'envois ainsi que ce que je pense pourrais être la validation (voir enntre //).

<%
sendUrl="http://schemas.microsoft.com/cdo/configuration/sendusing"
smtpUrl="http://schemas.microsoft.com/cdo/configuration/smtpserver"

' Set the mail server configuration
Set objConfig=CreateObject("CDO.Configuration")
objConfig.Fields.Item(sendUrl)=2 ' cdoSendUsingPort
objConfig.Fields.Item(smtpUrl)="relay-hosting.secureserver.net"

' Create and send the mail
Set objMail=CreateObject("CDO.Message")
' Use the config object created above
Set objMail.Configuration=objConfig
objMail.From = """UserWeb@mmcm.com""" & request.form("email")
objMail.ReplyTo= request.form("email")
objMail.To="distribution@autosphere.ca"
objMail.Subject="Abonnement"
objMail.HTMLBody= "<table border='1' cellspacing='0' cellpadding='0' width='600'><tr><td width='300'><p><strong>Magazine</strong></p></td><td width='300'><p>"
objMail.HTMLBody= objMail.HTMLBody & "</p></td></tr><tr><td width='300'><p><strong>Nom</strong></p></td><td width='300'><p>"
//if request.form("name") <> ""
objMail.HTMLBody= objMail.HTMLBody & request.form("name")
else
   response.write ("Veuillez indique votre nom")
end if//
objMail.HTMLBody= objMail.HTMLBody & "</p></td></tr><tr><td><p><strong>Pr&eacute;nom</strong></p></td><td width='300'><p>"
if request.form("name") <> ""
objMail.HTMLBody= objMail.HTMLBody & request.form("firstName")
else
   response.write ("Veuillez indique votre prénom")
end if
objMail.HTMLBody= objMail.HTMLBody & Request.Form("firstName")
etc...


Merci

Frédéric
Modifié par eiffel74 (10 May 2010 - 17:28)