Fix deco javascript: current grade was not properly selected
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 23 Sep 2007 08:30:18 +0000 (10:30 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 23 Sep 2007 08:30:18 +0000 (10:30 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
templates/profile/deco.tpl

index b4eb62b..e28ee82 100644 (file)
@@ -52,7 +52,11 @@ function buildGrade(id, current)
     var html = 'Agrafe : <select name="medals[' + id + '][grade]">';
     html += '<option value="0">Non précisée</option>';
     for (grade = 0 ; grade < subg.length ; grade++) {
-      html += '<option value="' + subg[grade][0] + '">' + subg[grade][1] + '</option>';
+      html += '<option value="' + subg[grade][0] + '"';
+      if (subg[grade][0] == current) {
+        html += ' selected="selected"';
+      }
+      html += '>' + subg[grade][1] + '</option>';
     }
 
     html += '</select>';