Commit 6ddd55a
committed
Serious bug with the input validate method
I was working with some form validation on a public facing site and noticed that the current validationEngine code does not properly validate single input fields in a form. The bug was discovered as an issue of "re-scoping".
Within the else block of the methods._validate() function, the valid variable was being rescoped and edited within. However, the variable assignment would not transcend up to the global function variables (see Line 106). As such, I removed the "re-scoping" and added a return !valid because the value of valid after Lines 140-144 is inverted. We need to properly return True for Valid and False for Invalid.1 parent e48070d commit 6ddd55a
1 file changed
+11
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
137 | | - | |
138 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
139 | 147 | | |
140 | 148 | | |
141 | 149 | | |
| |||
0 commit comments