bonjour,
J'utilise un checkbox dans un formulaire. J'arrive à savoir si une nouvelle case a été cochée mais je ne sais pas quand une case est décochée.
Voici mon code jsp:
dans mon form j'ai une variable warning(boolean)
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 <%@ taglib uri="http://struts.apache.org/tags-bean-el" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-logic-el" prefix="logic" %> <%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-nested" prefix="nested" %> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <%@ taglib uri="http://displaytag.sf.net" prefix="display" %> <jsp:useBean id="saisieTemplateForm" scope="session" class="net.gicm.methodes.exemple.form.SaisirTemplateForm"/> <html:xhtml/> <script type="text/javascript"> function valider() { document.forms[0].submit(); return false; } function submitenter(e) { if (enter(e)) { return valider(); } else { return true; } } </script> <html:form action="saisieValiderTemplate" method="post" onsubmit="messageAttente()"> <c:if test="${!empty saisieTemplateForm.name}"> Propriétés du model </c:if> <br/> <table> <tr> <td>Nom<font color=#FF0000>*</font>: </td> <td width=80> <html:text name="saisieTemplateForm" property="name" size="80" > </td> </tr> </table> <br/> <u>Service Notification</u> <table> <tr> <td> Options de notification </td> <td> <div align="left"> <html:checkbox name="saisieTemplateForm" property="warning" value="${saisieTemplateForm.warning}" >Warning</html:checkbox><br/> </div> </td> </tr> </table> <p class="texte_centre"> <html:image src="img/btn_valider_on.gif" property="valider" alt="valider"/> <html:link action="commandAnnuler.do"><img src="img/btn_annuler_on.gif" alt="valider"/></html:link> </p> </html:form>
et dans mon action j'ai mis un test :
Le problème c'est que si warning est initialisé à true, je ne saurai pas si cette case n'est plus cochée.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 if(stcf.iswarning()) test="w";
J'ai regardé le forum et les faq mais je n'ai rien vu de réellement correspondant,
quelqu'un aurait-il une idée?
Partager