Bonjour à tous,
J'ai un formulaire avec un bouton masqué. Lorsque les conditions sont remplies le bouton doit s'afficher.
Rendu html initial:
Code html : 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 <!DOCTYPE html> <html lang="fr"> <head> <meta charset="utf-8"> <title>Sélection ou modification d'une activité</title> <meta http-equiv="Expires" content="-1" /> <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> <base href="http://sirep.proginet.local" /> <link rel="stylesheet" media="all" type="text/css" href="../css/activity.css"> </head> <body> <form method="post" name="actForm"> <input type="hidden" name="id" value="3011"> <fieldset class="activity"><legend>Zone d'édition : Sélection d'une activité</legend> <label><span>Section</span><select name='naf[]'><option value='' label='< ---- >'></option><option value='1'>SECTION A - AGRICULTURE, SYLVICULTURE ET PÊCHE</option><option value='2'>SECTION B - INDUSTRIES EXTRACTIVES</option><option value='3'>SECTION C - INDUSTRIE MANUFACTURIÈRE</option></select></label><br> <label><span>Division</span><select name='naf[]'><option value='' label='< ---- >'></option></select></label><br> <label><span>Groupe</span><select name='naf[]'><option value='' label='< ---- >'></option></select></label><br> <label><span>Activité</span><select name='naf[]'><option value='' label='< ---- >'></option></select></label><br> <p><input type="submit" name="save" value="Enregistrer"></p> </fieldset> </form> <script>const emptyOption = "<option value='' label='< ---- >'><\/option>";</script> <script type="module" src="../js/customerActivitiesHandler.js"></script> </body> </html>
Code CSS : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 form[name="actForm"] .activity input[type='submit'] { display:none; }A la ligne 2 du code JS, le message 'vvv' s'affiche conformément aux conditions mais le bouton save ne s'affiche pas.
Code JS : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 if(nafs[0].value !='' && nafs[1].value !='' && nafs[2].value !='' && nafs[3].value !=''){ alert('vvv'); form.save.style.display = 'inlineBlock'; }
Partager