David Saylor commited on
Commit
d297969
·
1 Parent(s): 2d14884

updated with fix using jquery to reload hidden fields properly

Browse files
Files changed (3) hide show
  1. CHRIS.py +6 -3
  2. templates/index.html +8 -7
  3. templates/report.html +2 -0
CHRIS.py CHANGED
@@ -65,16 +65,19 @@ def app_post():
65
  impurity = float(request.form["impurity"]) * amount * 1e-2
66
  if caIndex == 11:
67
  MW = caData[caIndex][2]
68
- chemName = '*' + request.form["chemName"] + '*'
 
69
  impurity = float(request.form["impurity"]) * amount * 1e-2
70
  if caIndex == 12:
71
  MW = float(request.form["MW"])
72
- chemName = '*' + request.form["chemName"] + '*'
 
73
  impurity = float(request.form["impurity"]) * amount * 1e-2
74
  if caIndex == 13:
75
  isCA = False
76
  MW = float(request.form["MW"])
77
- chemName = '*' + request.form["chemName"] + '*'
 
78
 
79
  if exposure != "limited":
80
  time = 24.
 
65
  impurity = float(request.form["impurity"]) * amount * 1e-2
66
  if caIndex == 11:
67
  MW = caData[caIndex][2]
68
+ chemName = request.form["chemName"] if "chemName" in request.form else "CHEMICAL NAME NOT PROVIDED"
69
+ chemName = '*' + chemName + '*'
70
  impurity = float(request.form["impurity"]) * amount * 1e-2
71
  if caIndex == 12:
72
  MW = float(request.form["MW"])
73
+ chemName = request.form["chemName"] if "chemName" in request.form else "CHEMICAL NAME NOT PROVIDED"
74
+ chemName = '*' + chemName + '*'
75
  impurity = float(request.form["impurity"]) * amount * 1e-2
76
  if caIndex == 13:
77
  isCA = False
78
  MW = float(request.form["MW"])
79
+ chemName = request.form["chemName"] if "chemName" in request.form else "CHEMICAL NAME NOT PROVIDED"
80
+ chemName = '*' + chemName + '*'
81
 
82
  if exposure != "limited":
83
  time = 24.
templates/index.html CHANGED
@@ -38,9 +38,9 @@ Identity: <select name="CA" id="CA" onchange="javascript:caCheck();">
38
  <option value="{{CA}}">{{CA}}</option>
39
  {% endfor %}
40
  </select>
41
- <span id="otherID" style="visibility:hidden">
42
- &nbsp; &rArr; Chemical name: <input name="chemName" id="chemName" type="text" value="ENTER CHEMICAL NAME" required><br>
43
- </span>
44
 
45
  Molecular weight (g/mol): <input name="MW" id="MW" step="any" value="1100" min="100.0" max="1100.0" type="number" disabled required><br>
46
 
@@ -67,12 +67,14 @@ function caCheck() {
67
  document.getElementById('MW').disabled = false;
68
  }
69
  if (iCA >= 11) {
70
- document.getElementById('otherID').style.visibility = 'visible';
71
  document.getElementById('chemName').value = "ENTER CHEMICAL NAME";
72
  } else {
73
- document.getElementById('otherID').style.visibility = 'hidden';
74
  }
75
  }
 
 
76
  </script>
77
 
78
  <!-- Modal -->
@@ -220,10 +222,9 @@ function exposureCheck() {
220
  document.getElementById('time').value = '24';
221
  }
222
  }
 
223
  </script>
224
 
225
 
226
-
227
-
228
  </body>
229
  </html>
 
38
  <option value="{{CA}}">{{CA}}</option>
39
  {% endfor %}
40
  </select>
41
+ <span id="otherID" style="display:none">
42
+ &nbsp; &rArr; Chemical name: <input name="chemName" id="chemName" type="text" value="ENTER CHEMICAL NAME" required>
43
+ </span> <br>
44
 
45
  Molecular weight (g/mol): <input name="MW" id="MW" step="any" value="1100" min="100.0" max="1100.0" type="number" disabled required><br>
46
 
 
67
  document.getElementById('MW').disabled = false;
68
  }
69
  if (iCA >= 11) {
70
+ document.getElementById('otherID').style.display = "inline";
71
  document.getElementById('chemName').value = "ENTER CHEMICAL NAME";
72
  } else {
73
+ document.getElementById('otherID').style.display = "none";
74
  }
75
  }
76
+
77
+ $(window).on('pageshow', function() { caCheck(); });
78
  </script>
79
 
80
  <!-- Modal -->
 
222
  document.getElementById('time').value = '24';
223
  }
224
  }
225
+ $(window).on('pageshow', function() { exposureCheck(); });
226
  </script>
227
 
228
 
 
 
229
  </body>
230
  </html>
templates/report.html CHANGED
@@ -201,5 +201,7 @@ of {{MOS}}.
201
 
202
  {% endif %}
203
 
 
 
204
  </body>
205
  </html>
 
201
 
202
  {% endif %}
203
 
204
+ <button type="button" onclick="javascript:history.back()">Back</button>
205
+
206
  </body>
207
  </html>