[ASP] Validation de formulaire qui ne fonctionne pas
Bonjour à tous,
je suis en pleine création d'une page d'inscription et de connexion (2 formulaires sur la même pages)
j'ai bien séparé les deux formulaires avec "ValidationGroup", mais le formulaire se valide alors qu'il devrait renvoyer des erreurs
voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
| <asp:Content ID="Content2" ContentPlaceHolderID="corpsContent" Runat="Server">
<asp:Panel ID="Connexion" runat="server">
<h2>Vous êtes client?</h2>
<h3>Connectez-vous :</h3>
<asp:Table ID="tableLogin" runat="server">
<asp:TableRow>
<asp:TableCell>Login :</asp:TableCell><asp:TableCell><asp:TextBox ID="tbLogin" runat="server" ValidationGroup="gConnexion"/></asp:TableCell><asp:TableCell>
<asp:RequiredFieldValidator
ID="rfvLogin"
EnableClientScript = "true"
ControlToValidate = "tbLogin"
text = "#"
ErrorMessage = "Champ obligatoire"
Enabled = "true"
runat = "server"/>
</asp:TableCell><asp:TableCell>
<asp:RegularExpressionValidator
ID="revLogin"
ValidationExpression = "^([\w.]+)@([\w]+)\.([\w]{2,3})$"
EnableClientScript = "true"
ControlToValidate = "tbLogin"
text = "*"
ErrorMessage = "Adresse mail invalide"
runat = "server"/>
</asp:TableCell></asp:TableRow><asp:TableRow>
<asp:TableCell>Mot de passe :</asp:TableCell><asp:TableCell><asp:TextBox ID = "tbMdp" TextMode = "Password" runat = "server" ValidationGroup="gConnexion"/></asp:TableCell><asp:TableCell>
<asp:RequiredFieldValidator
ID="rfvMdp"
EnableClientScript = "true"
ControlToValidate = "tbMdp"
text = "#"
ErrorMessage = "Champ obligatoire"
Enabled = "true"
runat = "server"/>
</asp:TableCell></asp:TableRow></asp:Table>
<asp:Button class="btnValid" ID="validConnexion" runat="server" Text="Valider" ValidationGroup="gConnexion" OnClick="validConnexion_Click"/>
<asp:Label ID="Label1" runat="server">
</asp:Label><asp:ValidationSummary
ValidationGroup="gConnexion"
HeaderText = "Erreurs de saisie :"
ID = "vsConnexion"
EnableClientScript = "true"
DisplayMode = "BulletList"
runat = "server"
Width = "400"/>
</asp:Panel>
<asp:Panel ID="Inscription" runat="server">
<h2>Pas encore inscrit?</h2><h3>30 secondes suffisent pour vous inscrire et accéder à nos offres! </h3><asp:Table ID="table1" runat="server">
<asp:TableRow>
<asp:TableCell>Nom :</asp:TableCell><asp:TableCell><asp:TextBox ID="tbNom" runat="server" ValidationGroup="gInscription"/></asp:TableCell></asp:TableRow><asp:TableRow>
<asp:TableCell>Prenom :</asp:TableCell><asp:TableCell><asp:TextBox ID = "tbPrenom" runat = "server" ValidationGroup="gInscription" /></asp:TableCell></asp:TableRow><asp:TableRow>
<asp:TableCell>N° de la rue :</asp:TableCell><asp:TableCell><asp:TextBox ID="tbNumRue" runat="server" width="60" ValidationGroup="gInscription"/></asp:TableCell></asp:TableRow><asp:TableRow>
<asp:TableCell>Rue :</asp:TableCell><asp:TableCell><asp:TextBox ID = "tbRue" runat = "server" width="280" ValidationGroup="gInscription"/></asp:TableCell></asp:TableRow><asp:TableRow>
<asp:TableCell>Code Postal :</asp:TableCell><asp:TableCell><asp:TextBox ID="tbCp" runat="server" ValidationGroup="gInscription"/></asp:TableCell></asp:TableRow><asp:TableRow>
<asp:TableCell>Ville :</asp:TableCell><asp:TableCell><asp:TextBox ID = "tbVille" runat = "server" ValidationGroup="gInscription" /></asp:TableCell></asp:TableRow><asp:TableRow>
<asp:TableCell>Pays :</asp:TableCell><asp:TableCell><asp:TextBox ID = "tbPays" runat = "server" ValidationGroup="gInscription" /></asp:TableCell></asp:TableRow></asp:Table><hr /><asp:Table ID="tableMail" runat="server">
<asp:TableRow>
<asp:TableCell>Mail :</asp:TableCell><asp:TableCell><asp:TextBox ID = "tbMail" runat="server" width="200" ValidationGroup="gInscription"/></asp:TableCell><asp:TableCell>
<asp:RequiredFieldValidator
ID="rfvMail"
EnableClientScript = "true"
ControlToValidate = "tbMail"
text = "#"
ErrorMessage = "Champs obligatoire"
Enabled = "true"
runat = "server"/>
</asp:TableCell><asp:TableCell>
<asp:RegularExpressionValidator
ID="revMail"
ValidationExpression = "^([\w.]+)@([\w]+)\.([\w]{2,3})$"
EnableClientScript = "true"
ControlToValidate = "tbMail"
text = "*"
ErrorMessage = "Adresse mail invalide"
runat = "server"/>
</asp:TableCell><asp:TableCell>
<asp:CompareValidator
ID="cvMp"
EnableClientScript = "true"
ControlToValidate = "tbMail"
ControlToCompare = "tbMailConfirm"
text = "*"
ErrorMessage = "Champs obligatoire"
Enabled = "true"
runat = "server"/>
</asp:TableCell></asp:TableRow><asp:TableRow>
<asp:TableCell>Confirmation du mail :</asp:TableCell><asp:TableCell><asp:TextBox ID = "tbMailConfirm" runat = "server" width="200" ValidationGroup="gInscription"/></asp:TableCell><asp:TableCell>
<asp:RequiredFieldValidator
ID="rfvMailConfirm"
EnableClientScript = "true"
ControlToValidate = "tbMailConfirm"
text = "#"
ErrorMessage = "Champs obligatoire"
Enabled = "true"
runat = "server"/>
</asp:TableCell><asp:TableCell>
<asp:RegularExpressionValidator
ID="revMailConfirm"
ValidationExpression = "^([\w.]+)@([\w]+)\.([\w]{2,3})$"
EnableClientScript = "true"
ControlToValidate = "tbMailConfirm"
text = "*"
ErrorMessage = "Adresse mail invalide"
runat = "server"/>
</asp:TableCell></asp:TableRow></asp:Table><hr /><asp:Table ID="tableMdp" runat="server">
<asp:TableRow>
<asp:TableCell>Mot de passe :</asp:TableCell><asp:TableCell><asp:TextBox ID = "tbMdpInsc" TextMode = "Password" runat="server" ValidationGroup="gInscription"/></asp:TableCell><asp:TableCell>
<asp:RequiredFieldValidator
ID="rfvMdpInsc"
EnableClientScript = "true"
ControlToValidate = "tbMdpInsc"
text = "#"
ErrorMessage = "Champs obligatoire"
Enabled = "true"
runat = "server"/>
</asp:TableCell><asp:TableCell>
<asp:CompareValidator
ID="cvMdpInsc"
EnableClientScript = "true"
ControlToValidate = "tbMdpInsc"
ControlToCompare = "tbMdpConfirm"
text = "*"
ErrorMessage = "Champs obligatoire"
Enabled = "true"
runat = "server"/>
</asp:TableCell></asp:TableRow><asp:TableRow>
<asp:TableCell>Confirmation du mot de passe :</asp:TableCell><asp:TableCell><asp:TextBox ID = "tbMdpConfirm" TextMode = "Password" runat = "server" ValidationGroup="gInscription" /></asp:TableCell><asp:TableCell>
<asp:RequiredFieldValidator
ID="rfvMdpInscConf"
EnableClientScript = "true"
ControlToValidate = "tbMdpConfirm"
text = "#"
ErrorMessage = "Champs obligatoire"
Enabled = "true"
runat = "server"/>
</asp:TableCell></asp:TableRow></asp:Table><asp:Button class="btnValid" ID="validInscription" runat="server" Text="Valider" ValidationGroup="gInscription"/>
<asp:ValidationSummary
ValidationGroup="gInscription"
HeaderText = "Erreurs de saisie :"
ID = "vsInscription"
EnableClientScript = "true"
DisplayMode = "BulletList"
runat = "server"
Width = "400"/>
</asp:Panel>
</asp:Content> |
voyez vous un problème? je n' ai rien en code behind
merci d'avance pour votre aide