Bonjour,
J'utilise un <logic:iterate> pour afficher une liste dans une Popup. Cette liste comporte une checkBox en première colonne.
Si l'utilisateur sélectionne une ligne et click sur "Valider" je dois récupérer la ligne validée pour alimenter des champs de la fenêtre "mère".
Ca fonctionne très bien si j'ai plus d'une ligne dans ma liste. Par contre si j'ai une seule ligne d'afficher, la sélection n'est pas prise en compte.
Dans le cas où je n'ai qu'une seule ligne, quand je visualise la valeur de la donnée "document.forms["listeAttestation"].Selection.length" j'obtiens "undefined". Si plusieurs lignes affichées, j'obtiens bien le nombre de lignes...
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 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%@ taglib uri="struts-html.tld" prefix="html"%> <%@ taglib uri="serveurflux.tld" prefix="sf" %> <%@ taglib uri="struts-bean.tld" prefix="bean" %> <%@ taglib uri="struts-logic.tld" prefix="logic" %> <%@ taglib uri="c.tld" prefix="c" %> <%@ page import="java.util.*"%> <%@ page import="com.soltim.aneto.recyclage.ressources.RequestParameters"%> <sf:js name="formulaireRechercheV2.js" subdirectory="attestations"/> <jsp:useBean id="fctdetail" scope="session" class="com.soltim.aneto.recyclage.modele.bean.FctBO"/> <head> <sf:css subdirectory="recyclage" name="recyclage.css" /> <title>Liste des attestations</title> <script type="text/javascript" language="Javascript"> function validateWithLink() { for (var i = 0; i < document.forms["listeAttestation"].Selection.length; i++) { if (document.forms["listeAttestation"].Selection[i].checked == true) { var NumInsee = document.forms["listeAttestation"].Selection[i].value.substr(0,13); var CleInsee = document.forms["listeAttestation"].Selection[i].value.substr(13,2); var DateNais = document.forms["listeAttestation"].Selection[i].value.substr(15,10); var RangNais = document.forms["listeAttestation"].Selection[i].value.substr(25,1); alert (document.forms["listeAttestation"].Selection[i].value.substr(0,13)); opener.document.forms["FCT_modification"].elements["<%=RequestParameters.NEW_INSEE_NUM%>"].value=NumInsee; opener.document.forms["FCT_modification"].elements["<%=RequestParameters.NEW_INSEE_CLE%>"].value=CleInsee; opener.document.forms["FCT_modification"].elements["DateNaissance"].value=DateNais; opener.document.forms["FCT_modification"].elements["<%=RequestParameters.NEW_RANG%>"].value=RangNais; } } window.close(); } </script> </head> <body style="margin: 0px"> <form name="listeAttestation" > <TABLE width="95%" border="0" cellspacing="1" cellpadding="2" align="center"> <tr> <td class="LILibelleB1"> </td> <td class="LILibelleB1"><bean:message key="consultation.attestation.liste.resultat.identite" /></td> <td class="LILibelleB1"><bean:message key="consultation.attestation.formulaire.recherche.num.insee" /></td> <td class="LILibelleB1"><bean:message key="consultation.attestation.detail.date.naissance" /></td> <td class="LILibelleB1"><bean:message key="consultation.attestation.detail.rang" /></td> <td class="LILibelleB1"><bean:message key="consultation.attestation.formulaire.recherche.num.adherent" /></td> <td class="LILibelleB1"><bean:message key="consultation.attestation.detail.validite" /></td> <td class="LILibelleB1"><bean:message key="consultation.attestation.formulaire.recherche.num.amc" /></td> <td class="LILibelleB1"><bean:message key="consultation.attestation.liste.resultat.num.contrat" /></td> <td class="LILibelleB1"><bean:message key="consultation.attestation.liste.resultat.date.debut" /></td> <td class="LILibelleB1"><bean:message key="consultation.attestation.liste.resultat.date.fin" /></td> </tr> <logic:present name="AfficherAttestBean" scope="request"> <logic:iterate id="attestation" name="AfficherAttestBean" property="lstResultat"> <c:choose> <c:when test="${typeClass == null}"> <c:set var="typeClass" scope="page" value="LIDonneeB1" /> </c:when> <c:when test="${typeClass == 'LIDonneeB1'}"> <c:set var="typeClass" scope="page" value="LIDonneeB2" /> </c:when> <c:otherwise> <c:set var="typeClass" scope="page" value="LIDonneeB1" /> </c:otherwise> </c:choose> <logic:iterate id="droit" name="attestation" property="lstDroits"> <logic:present name="droit"> <tr id="attestation<bean:write name="attestation" property="uid"/>-<bean:write name="attestation" property="numRectoAttestation"/>" onclick="javascript:selectionnerLigne( 'attestation<bean:write name="attestation" property="uid"/>-<bean:write name="attestation" property="numRectoAttestation"/>' );" class="<c:out value="${typeClass}"/>" onmouseover="setTrClass(this, 'LIDonneeOverB');" onmouseout="setTrClass(this, '<c:out value="${typeClass}"/>');"> <td nowrap> <INPUT type="radio" name="Selection" value="<bean:write name="droit" property="numInseeBenef" /><bean:write name="droit" property="dateNaissanceStr" /><bean:write name="droit" property="rangNaissance" />" > </td> <td nowrap><a href="javascript:openAttestations(<bean:write name="attestation" property="uid"/>,<bean:write name="attestation" property="numRectoAttestation"/>)"> <bean:write name="droit" property="nomPrenomBenef" /> </a></td> <td nowrap> <bean:write name="droit" property="numInseeBenefAffichable" /> </td> <td nowrap> <bean:write name="droit" property="dateNaissanceStr" /> </td> <td nowrap> <bean:write name="droit" property="rangNaissance" /> </td> <td nowrap> <bean:write name="attestation" property="numAdherent" /> </td> <td align="center"><c:if test="${attestation.indicateurValidite=='V'}"> <img src='<sf:image name="ico16Valid.gif"/>' alt="valide" /> </c:if> <c:if test="${attestation.indicateurValidite!='V'}"> <img src='<sf:image name="ico16Invalid.gif"/>' alt="invalide" /> </c:if></td> <td nowrap><bean:write name="attestation" property="numAmcDetaille" /></td> <td nowrap> <bean:write name="attestation" property="numContrat" /> </td> <td nowrap align="center"><bean:write name="attestation" property="dateDebutDroitStr" /></td> <td nowrap align="center"><bean:write name="attestation" property="dateFinDroitStr" /></td> </tr> </logic:present> </logic:iterate> </logic:iterate> <tr> <td align="center" colspan="10"> <a href="javascript:this.close()" class="AdminBT_J">Retour</a> <a href="javascript:void(0)" onClick="return validateWithLink()" class="AdminBT_J">Valider</a> </td> </tr> </logic:present> <logic:notPresent name="AfficherAttestBean" scope="request"> <tr> <td nowrap align="center" colspan="10">Pas d'attestations pour cet assuré</td> </tr> <tr> <td align="center" colspan="10"> <a href="javascript:this.close()" class="AdminBT_J">Retour</a> </td> </tr> </logic:notPresent> </TABLE> </form> </body>
Quelqu'un peut-il m'aider car je sèche lamentablement ?
Merci d'avance pour les pistes que vous pourrez me donner...
![]()
Partager