Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Form Validation] Add "not" option to rule #2638

Closed
fpayer opened this issue Jul 14, 2015 · 1 comment
Closed

[Form Validation] Add "not" option to rule #2638

fpayer opened this issue Jul 14, 2015 · 1 comment
Milestone

Comments

@fpayer
Copy link

fpayer commented Jul 14, 2015

Copied from the example on the docs: http://semantic-ui.com/behaviors/form.html#/examples

There is a "contains" rule which checks if a substring exists, and a "not" rule which checks if the form value equals a preset value; however, there is no "notContains" rule to check that a substring does not exist.

See the below JSFiddle:
https://jsfiddle.net/rduvhn8u/80/

If you enter "mean", the validation will error, but if you enter, "mean fluffy dog", the validation will pass. There should be a way to reverse the expected value of a rule so that the "contains" rule could check that a string does not exist. I would suggest adding a "!" in front of the rule's type.

@fpayer fpayer changed the title [Validate] How to not a rule [Form Validation] Add "not" option to rule Jul 14, 2015
@jlukic jlukic added this to the 2.0.4 milestone Jul 14, 2015
@jlukic
Copy link
Member

jlukic commented Jul 14, 2015

I prefer including separate rules for negating conditions, I think it might be counterintuitive to use a separate property.

@jlukic jlukic closed this as completed Jul 14, 2015
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants