Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Trailing space doesn't trigger invalidation for regex excluding spaces #338

Closed
johnhorner opened this issue May 21, 2016 · 2 comments
Closed
Labels

Comments

@johnhorner
Copy link

johnhorner commented May 21, 2016

I don't know if this is related to issue 98 but although my regular expression only allows ^[A-z0-9]{3,30}$ putting a trailing space doesn't cause the field to become invalidated, i.e. 'foo bar' causes a match error, but not 'foobar '.

@1000hz
Copy link
Owner

1000hz commented May 21, 2016

Thanks for the report. You found a bug. The plugin calls $.trim() on field values before it validates them. This was originally added to prevent whitespace-filled fields from being considered valid by the required validator, but now it's being applied too broadly. Additionally, there was a recent addition to the plugin to prevent fields from re-running their validators if their value hasn't changed. In this case, the field values are being compared after the trim so the plugin thinks the field has not changed.

Either the trim needs to be more deliberately placed or I need to get rid of the problematic optimization altogether.

@1000hz 1000hz added the bug label May 21, 2016
@johnhorner
Copy link
Author

Thanks for the response, glad I could help.

@1000hz 1000hz closed this as completed in 96f97c4 Jul 15, 2016
1000hz added a commit that referenced this issue Jul 15, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants