Skip to content

Conversation

@stephnr
Copy link
Contributor

@stephnr stephnr commented Oct 29, 2014

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.

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.
posabsolute added a commit that referenced this pull request Dec 2, 2014
Bug with Validate Field function
@posabsolute posabsolute merged commit 29e706c into posabsolute:master Dec 2, 2014
@dennybrandes dennybrandes added this to the 3.0.0 milestone Jul 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants