Javascript et Jsf (Validation formulaire)
Bonjour à tous,
J'utilise la bibliothèque richfaces(JSF) pour dessiner mon interface(Formulaire).
J'utilise une fonction Javascript pour valider ce formulaire. La fonction s'exécute parfaitement mais l'action est exécuter : je veux faire une validation avant insertion alors la validation est faite, le model panel dans le quel est dessiné le formulaire reste ouvert avec les informations mais l'insertion se fait!!!!!!
Est ce quelqu'un a une idée????
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
| <!----------------------------ajout Panel -------------------------------------------->
<rich:modalPanel id="ajoutPanel" autosized="false" height="500" width="600" style="dr-mpnl-pnl" >
<div class="scroll" >
<f:facet name="header">
<h:outputText value="Ajouter Utilisateur" />
</f:facet>
<f:facet name="controls">
<h:panelGroup>
<h:graphicImage value="/images/close.png" style="border:0"
id="hidelinkAjout" styleClass="hidelink" />
<rich:componentControl for="ajoutPanel" attachTo="hidelinkAjout"
operation="hide" event="onclick" />
</h:panelGroup>
</f:facet>
<h:form id="ajoutForm">
<h:panelGrid columns="1" id="panelUtilisateurs">
<a4j:outputPanel ajaxRendered="true">
<h:panelGrid border="0" columns="4" cellpadding="5" >
<h:outputText value="Login:" styleClass="input" />
<h:inputText value="#{utilisateursUI.ajoutlogin}" styleClass="input" id="loginAjout"/>
<h:outputText value="Nom Prénom:" styleClass="input" />
<h:inputText value="#{utilisateursUI.ajoutnomPrenom}"
styleClass="input" />
<h:outputText value="Mot de passe:" styleClass="input" />
<h:inputSecret redisplay="false" value="#{utilisateursUI.ajoutpassword}" styleClass="input" id="ajoutpassword"/>
<h:outputText value="Confirmer Mot de passe:" styleClass="input" />
<h:inputSecret redisplay="false" value="#{utilisateursUI.ajoutpasswordConfirm}" styleClass="input" id="ajoutpasswordConfirm"/>
<h:outputText value="Mail:" styleClass="input" />
<h:inputText value="#{utilisateursUI.ajoutmail}"
styleClass="input" id="email" >
</h:inputText>
<h:panelGrid columns="2">
<h:selectBooleanCheckbox value="#{utilisateursUI.ajoutfActif}" />
<h:outputText value="Compte Actif" styleClass="input" />
</h:panelGrid>
<h:outputText value=" " styleClass="input" />
</h:panelGrid>
<table>
<tr>
<td width="250px" >
<h:panelGrid border="0" columns="2" cellpadding="5" >
<h:selectBooleanCheckbox value="#{utilisateursUI.ajoutSuperUser}"/>
<h:outputText value="Super Utilisateur" styleClass="input" style="width=100px;"/>
<h:selectBooleanCheckbox value="#{utilisateursUI.ajoutfAdmin}" />
<h:outputText value="Compte Admin" styleClass="input" />
<h:selectBooleanCheckbox value="#{utilisateursUI.ajoutElligible}"/>
<h:outputText value="Eligible" styleClass="input" />
</h:panelGrid>
</td>
<td width="200px">
<h:panelGrid border="0" columns="2" cellpadding="5" >
<h:outputText value="Observations:" styleClass="input" id="ajoutObs"/>
<h:inputTextarea value="#{utilisateursUI.ajoutObs}"
styleClass="input" style=" width=180px; height=70px;"/>
</h:panelGrid>
</td>
</tr>
</table>
</a4j:outputPanel>
<rich:listShuttle sourceValue="#{utilisateursUI.listProfils}"
id="listProfil"
targetValue="#{utilisateursUI.listProfilSelectionnes}" var="items"
copyControlLabel="Ajouter"
copyAllControlLabel="Ajouter Tout"
removeAllControlLabel="Enlever tout"
removeControlLabel="Enlever"
bottomControlLabel="Dernier"
upControlLabel="Premier"
downControlLabel="Déscendre"
topControlLabel="Monter"
converter="converterJsf"
sourceCaptionLabel="Liste Profils"
targetCaptionLabel="Liste Profils Affectés" >
<h:column>
<h:outputText value="#{items.id.desProfil}"></h:outputText>
</h:column>
</rich:listShuttle>
<rich:listShuttle sourceValue="#{utilisateursUI.listOperateur}"
id="listOperateur"
targetValue="#{utilisateursUI.listOPSelectionnes}" var="ops"
copyControlLabel="Ajouter"
copyAllControlLabel="Ajouter Tout"
removeAllControlLabel="Enlever tout"
removeControlLabel="Enlever"
bottomControlLabel="Dernier"
upControlLabel="Premier"
downControlLabel="Déscendre"
topControlLabel="Monter"
converter="converterOpJsf"
sourceCaptionLabel="Liste Opérateurs"
targetCaptionLabel="Liste Opérateurs Affectés" >
<h:column>
<h:outputText value="#{ops.des}" ></h:outputText>
</h:column>
</rich:listShuttle>
</h:panelGrid>
<table align="right" width="70%">
<tr>
<td align="right">
<a4j:commandButton type="submit" value="Valider" action="#{utilisateursUI.validerAjout}" onclick=" validLogin(); " limitToList="true" id="idComm"/>
</td>
</tr>
</table>
</h:form>
</div>
</rich:modalPanel> |
La fonction Javascript!!!!
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| function validate() {
if(validLogin())
{
if(compare() == true){
if(validateEmail())
ajoutForm.submit();
}
}
return false;
} |