jsp+struts : problème onchange
Bonjour,
J'ai deux listes dépendantes, projet et fiche evaluation, je veux choisir un projet dans la première liste et avoir les fiches d'évaluation correspondantes à ce projet dans la deuxième liste.
voila mon action (dans evaluationAction.java)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
EvaluationManager mgr = (EvaluationManager) getBean("evaluationManager");
List evaluations = mgr.getEvaluations(null);
request.setAttribute(Constants.EVALUATION_LIST, evaluations);
FicheEvaluationManager ficheEvaluationManager=(FicheEvaluationManager)getBean("ficheEvaluationManager");
FicheEvaluation ficheEvaluation = new FicheEvaluation();
List fiches= ficheEvaluationManager.getFiches(null);
fiches.add(ficheEvaluation);
EvaluationForm evaluationForm = (EvaluationForm)form;
evaluationForm.setFiches(fiches);
request.getSession().setAttribute("fiches", fiches);
ProjetManager projetManager=(ProjetManager)getBean("projetManager");
Projet projet = new Projet();
List projets= projetManager.getProjets(null);
projets.add(projet);
evaluationForm.setProjets(projets);
request.getSession().setAttribute("projets", projets); |
et voila le code de ma page jsp:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
<FORM id=evaluation onsubmit="return validateEvaluationForm(this)" action="/cmmi/saveEvaluation.html" method="post" name="myform" >
<html:hidden property="id"/>
......
<html:select property="projetId" onchange="document.myform.submit()">
<html:options collection="projets" property="id" labelProperty="nomProjet" />
</html:select>
</td>
</tr>
<tr>
<td height="8">fiche dévaluation </td>
<td height="13" colspan="2">
<html:select property="ficheId">
<html:options collection="fiches" property="id" labelProperty="nomFiche" />
</html:select>
........
</FORM> |
le problème est que quand je selectionne un projet dans la première liste les valeurs par défault présents dans les différents champs s'insère dans la base, c'est comme si le "onchange" joue le rôle de valider. Je ne sais pas si la valeur passée en argument à onchange est fausse.
merci d'avance pour votre aide.