IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

Control d'un formulaire


Sujet :

JavaScript

  1. #1
    Membre éclairé
    Profil pro
    Inscrit en
    Février 2005
    Messages
    212
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Février 2005
    Messages : 212
    Par défaut Control d'un formulaire
    Bonjour,

    Je cherche à réaliser un control sur le champ Nom de mon formulaire
    (JavaSrcipt pour le coté client).
    Mon formulaire est en code html, mais l'ensemble se situe dans une page php.
    Je viens de passer de nombreuse heures et je ne comprends vraiment ce qui cloche. Si l'un d'entre vous peut m'aider, c'est sympa.

    Merci de votre aide.

    Voici un extrait de mon code.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
     
    <SCRIPT language="JavaScript">
    function verifier() {
    if (verif_ajout_patient_login.form1.Nom.value == "" ) {
    window.alert("Saisissez le nom");
    verif_ajout_patient_login.form1.Nom.focus();
    }
     
    else
     
    {
    verif_ajout_patient_login.form1.method = "POST";
    verif_ajout_patient_login.form1.action = "verif_ajout_patient.php?Login=<?php echo $Login; ?>";
    verif_ajout_patient_login.form1.submit();
    }
    }
    </SCRIPT>
     
    	<table class="TexteContenu" width="465" border="0" cellpadding="0" cellspacing="0" >
     
    			<tr>
    				<td width="50%"><p class="titre">Créer-votre profil.</p></td>
    			</tr>
     
    			<tr>
    				<td width="90%"><p class="titre">Etape 2/2 : Completez ce formulaire.</p></td>
    			</tr>
     
    			<tr>
    			<td width="90%"><p class="texte">Votre login est <? echo $Login ?>. Veuillez compléter ce second et dernier formulaire pour finaliser votre inscription</p></td>
    			</tr>
     
    			<tr>
    			<td>
    			<table width="465">
    			<form class="formulaire" name="form1">
    			<tr>
    				<td width="150" ><p class="texte">Nom : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Nom" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Prénom : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Prenom" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Mot de passe : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Password" type="password" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Mail : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Mail" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Date de naissance : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Date_Naissance" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Adresse : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Adresse" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Ville : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Ville" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Code postal : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Code_Postal" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Sexe : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Sexe" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Téléphone : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Tel" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" valign="top"><input type="reset" value="Annuler"></td>
    				<td width="200" valign="top"><input type="button" value="Valider" onClick="return verifier()"></td>
     
    			</tr>
    			</form>
    			</table>

  2. #2
    Membre Expert

    Profil pro
    Inscrit en
    Janvier 2005
    Messages
    1 278
    Détails du profil
    Informations personnelles :
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Janvier 2005
    Messages : 1 278
    Par défaut
    Quel est ton problème ?

  3. #3
    Membre émérite
    Avatar de jc_cornic
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    623
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 623
    Par défaut
    Salut, d'ou vient ton "verif_ajout_patient_login" ???

  4. #4
    Membre éclairé
    Profil pro
    Inscrit en
    Février 2005
    Messages
    212
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Février 2005
    Messages : 212
    Par défaut
    Le problème verif_ajout_patient_login est le nom de ma page. Car j'ai vu dans le forum qu'iil fallait attribuer la chemin de la case de la maniere suivante :

    document.nomduformulaire.champ.value

    Le debogueur javascript sur internet m'indique justement que cet objet est vide.

    Merci de votre aide

  5. #5
    Membre émérite
    Avatar de jc_cornic
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    623
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 623
    Par défaut
    Salut, quand tu dis le nom de ta page, ca veut dire verif_ajout_patient_login.php ???

    Car si oui, reessaye avec

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    if (document.form1.Nom.value == 0)
    ...
    ++
    JC

  6. #6
    Membre éclairé
    Profil pro
    Inscrit en
    Février 2005
    Messages
    212
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Février 2005
    Messages : 212
    Par défaut
    J'ai essayé avec les deux ca me dit toujour que l'objet est vide.

    Mais désromais je comprends qu'il faut utiliser "document".
    Certainement que "document" renvoi le chemin de la page traité et donc il ne faut pas donner le nom de la page;

    Merci de ton aide.

  7. #7
    Membre émérite
    Avatar de Dia_FR
    Homme Profil pro
    Développeur Web
    Inscrit en
    Avril 2006
    Messages
    512
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : Communication - Médias

    Informations forums :
    Inscription : Avril 2006
    Messages : 512
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    function verifier() {
    if (document.form1.Nom.value == "" ) {
    alert("Saisissez le nom");
    document.form1.Nom.focus();
    }
    pour des questions plus précises y a une section forum javascript ici
    Dia [ Page DVP ] [ Site pro ]

  8. #8
    Membre éclairé
    Profil pro
    Inscrit en
    Février 2005
    Messages
    212
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Février 2005
    Messages : 212
    Par défaut
    J'ai bien suivi vos conseil mais rien ny fait. Le message
    d'erreur est le suivant :

    document.form1.Nom.Value a la valaeur Null ou n'est pas un objet.

    Je ne vois vraiment pas d'ou provient l'erreur .
    A savoir que j'ai varié mon test: une fois == 0 et une autre ==""
    Et, j'ai toujours le meme message d'erreur.

    Merci pour votre aide


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
     
    <SCRIPT language="JavaScript">
    function verifier() {
    if (document.form1.Nom.value == 0 ) {
    window.alert("Saisissez le nom");
    document.form1.Nom.focus();
    }
     
    else
    {
    document.form1.method = "POST";
    document.form1.action = "verif_ajout_patient.php?Login=<?php echo $Login; ?>";
    document.form1.submit();
    }
    }
    </SCRIPT>
     
    	<table class="TexteContenu" width="465" border="0" cellpadding="0" cellspacing="0" >
     
    			<tr>
    				<td width="50%"><p class="titre">Créer-votre profil.</p></td>
    			</tr>
     
    			<tr>
    				<td width="90%"><p class="titre">Etape 2/2 : Completez ce formulaire.</p></td>
    			</tr>
     
    			<tr>
    			<td width="90%"><p class="texte">Votre login est <? echo $Login ?>. Veuillez compléter ce second et dernier formulaire pour finaliser votre inscription</p></td>
    			</tr>
     
    			<tr>
    			<td>
    			<table width="465">
    			<form class="formulaire" name="form1">
    			<tr>
    				<td width="150" ><p class="texte">Nom : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Nom" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Prénom : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Prenom" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Mot de passe : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Password" type="password" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Mail : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Mail" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Date de naissance : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Date_Naissance" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Adresse : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Adresse" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Ville : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Ville" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Code postal : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Code_Postal" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Sexe : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Sexe" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Téléphone : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Tel" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" valign="top"><input type="reset" value="Annuler"></td>
    				<td width="200" valign="top"><input type="button" value="Valider" onClick="return verifier()"></td>
     
    			</tr>
    			</form>
    			</table>else
    {
    document.form1.method = "POST";
    document.form1.action = "verif_ajout_patient.php?Login=<?php echo $Login; ?>";
    document.form1.submit();
    }
    }
    </SCRIPT>
     
    	<table class="TexteContenu" width="465" border="0" cellpadding="0" cellspacing="0" >
     
    			<tr>
    				<td width="50%"><p class="titre">Créer-votre profil.</p></td>
    			</tr>
     
    			<tr>
    				<td width="90%"><p class="titre">Etape 2/2 : Completez ce formulaire.</p></td>
    			</tr>
     
    			<tr>
    			<td width="90%"><p class="texte">Votre login est <? echo $Login ?>. Veuillez compléter ce second et dernier formulaire pour finaliser votre inscription</p></td>
    			</tr>
     
    			<tr>
    			<td>
    			<table width="465">
    			<form class="formulaire" name="form1">
    			<tr>
    				<td width="150" ><p class="texte">Nom : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Nom" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Prénom : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Prenom" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Mot de passe : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Password" type="password" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Mail : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Mail" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Date de naissance : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Date_Naissance" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Adresse : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Adresse" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Ville : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Ville" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Code postal : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Code_Postal" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Sexe : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Sexe" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Téléphone : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Tel" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" valign="top"><input type="reset" value="Annuler"></td>
    				<td width="200" valign="top"><input type="button" value="Valider" onClick="return verifier()"></td>
     
    			</tr>
    			</form>
    			</table>

  9. #9
    Membre émérite
    Avatar de Dia_FR
    Homme Profil pro
    Développeur Web
    Inscrit en
    Avril 2006
    Messages
    512
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : Communication - Médias

    Informations forums :
    Inscription : Avril 2006
    Messages : 512
    Par défaut
    c'est spécial comme manière de faire, 'fin perso j'aime pas trop

    perso je fais ça :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    <form name="..." method="..." action="..." onsubmit="return maFonc()">
     
    // différents champs
     
    <input type="submit" name="..." value="..." />
     
    </form>
     
     
    function maFonc() {
      var valide = false;
     
      if (champ1 == "")
        alert("achtung !");
      else if ...
     
      ...
     
      // si tout est ok
      else
        valide = true;
     
      return valide;
    }
    le coup de mettre un bouton normal au lieu du submit et d'affecter la method et l'action dans la fonction JS je trouve ça tordu mais passons
    (en plus quand tu relis le code ça fait bizarre de lire un form sans action ni method)

    dans la fonction le test c'est bien == "" et pas == 0
    et t'es pas obligé de préfixer alert par window.
    et mets document.form1.action = "verif_ajout_patient.php?Login=$Login;";

    ça ira mieux

    chez moi ça marche


    PS : si on rentre que des espaces, avec cette méthode ça passe, tu peux utiliser des regex pour virer ce problème :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    function trim(string) {
      return string.replace(/(^\s*)|(\s*$)/g,'');
    }
    ça vire les espaces en début et fin de chaîne

    et après, if (trim(champ1) == "")

    mieux
    Dia [ Page DVP ] [ Site pro ]

  10. #10
    Membre éclairé
    Profil pro
    Inscrit en
    Février 2005
    Messages
    212
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Février 2005
    Messages : 212
    Par défaut
    Tout d'abord je te remercie pour ton aide.

    Il me semble que j'ai respecter l'ensemble de tes explications.
    A part les espaces, mais je verrai dans un second temps.

    Toutefois sur clic, j'ai toujours le même message d'erreur qui me dit que
    document.form1.Nom.value a la valeur Null ou n'est pas un objet.
    Peut etre que j'ai mal défini ma page document.

    Voila je vais continuer a tatonner.

    Merci en tout cas.

    Bonne continuation.


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    	<table class="TexteContenu" width="465" border="0" cellpadding="0" cellspacing="0" >
     
    			<tr>
    				<td width="50%"><p class="titre">Créer-votre profil.</p></td>
    			</tr>
     
    			<tr>
    				<td width="90%"><p class="titre">Etape 2/2 : Completez ce formulaire.</p></td>
    			</tr>
     
    			<tr>
    			<td width="90%"><p class="texte">Votre login est <? echo $Login ?>. Veuillez compléter ce second et dernier formulaire pour finaliser votre inscription</p></td>
    			</tr>
     
    			<tr>
    			<td>
    			<table width="465">
     
    			<form action="verif_ajout_patient.php?Login=<?php echo $Login; ?>" method="post" class="formulaire" onsubmit="return verifier()" name="form1" >
    			<tr>
    				<td width="150" ><p class="texte">Nom : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Nom" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Prénom : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Prenom" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Mot de passe : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Password" type="password" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Mail : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Mail" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Date de naissance : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Date_Naissance" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Adresse : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Adresse" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Ville : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Ville" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Code postal : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Code_Postal" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Sexe : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Sexe" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" ><p class="texte">Téléphone : &nbsp;</p></td>
    				<td width="200" valign="top" height="20"><input name="Tel" type="text" size="40" /></td>
    			</tr>
     
    			<tr>
    				<td width="150" valign="top"><input type="reset" value="Annuler"></td>
    				<td width="200" valign="top"><input type="submit" value="Valider" </td>
     
    			</tr>
    			</form>
    			</table>
    			</td>
    			</tr>
    <tr>
    <td>			
    <br />	
    <SCRIPT language="JavaScript">
    function verifier() {
    document.form1.action = "verif_ajout_patient.php?Login=$Login;";
    var valide = false;
    if (document.form1.Nom.value == "" ) {
    alert("Saisissez le nom");
    }
    else
    {
    valide = true;
    return valide;
    }
    }
    </SCRIPT>

  11. #11
    Membre émérite
    Avatar de Dia_FR
    Homme Profil pro
    Développeur Web
    Inscrit en
    Avril 2006
    Messages
    512
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : Communication - Médias

    Informations forums :
    Inscription : Avril 2006
    Messages : 512
    Par défaut
    de rien

    je te corrige quand même quelques erreurs :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    <SCRIPT language="JavaScript">
    function verifier() {
    
    //document.form1.action = "verif_ajout_patient.php?Login=$Login;";
    //pas besoin de ça, tu l'as déjà mis en dur dans la balise form
    
    var valide = false;
    if (document.form1.Nom.value == "" ) {
    alert("Saisissez le nom");
    }
    else
    {
    valide = true;
    }
    return valide;
    
    // ne pas mettre le return dans le else, tu dois retourner la valeur de "valide" tout le temps
    
    }
    </SCRIPT>
    mais pour ton message d'erreur, j'comprends vraiment pas, j'ai re-recopié ton code chez moi et ça marche toujours...
    Dia [ Page DVP ] [ Site pro ]

  12. #12
    Membre éclairé
    Profil pro
    Inscrit en
    Février 2005
    Messages
    212
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Février 2005
    Messages : 212
    Par défaut
    Ok merci.
    En effet ca fonctionne correctement sous Mozilla mais pas sous IE.
    Surement un problème de securité. Mais en tout cas ce n'est pas un pb de code.


    Je te remercie car je dois bien avouer que je galerer un peu.


    @+
    ++

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Pb pour verouillé les controles d'un formulaire (VBA)
    Par Celia1303 dans le forum Access
    Réponses: 12
    Dernier message: 24/10/2005, 11h19
  2. taille d'un controle dans un formulaire
    Par kleenex dans le forum Access
    Réponses: 6
    Dernier message: 30/09/2005, 09h41
  3. Réponses: 5
    Dernier message: 07/09/2005, 08h27
  4. [C#] Custom Control : Recuperer valeur formulaire
    Par victorbru dans le forum ASP.NET
    Réponses: 22
    Dernier message: 21/04/2005, 09h02
  5. validation d'un controle dans un formulaire
    Par marjo20 dans le forum IHM
    Réponses: 5
    Dernier message: 10/10/2004, 23h00

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo