Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Make sure fieldValue in "core.fieldvalueisnot" is a string #52

Merged
merged 1 commit into from
Aug 4, 2016

Conversation

schonert
Copy link
Contributor

@schonert schonert commented Aug 4, 2016

When number passed through the method will fail. toLowerCase is not a method on a number

When number passed through the method will fail. toLowerCase is not a method on a number
@schonert schonert changed the title Make sure fieldValue in "core.fieldvalueisnot" Make sure fieldValue in "core.fieldvalueisnot" is a string Aug 4, 2016
@@ -275,7 +275,7 @@ addFormEditorCondition("core.fieldisempty", function (rule, fieldValue, formData
});
// - "field value is not" condition:
addFormEditorCondition("core.fieldvalueisnot", function (rule, fieldValue, formData) {
return (fieldValue || "").toLowerCase() != (rule.condition.expectedFieldValue || "").toLowerCase();
return (fieldValue + "" || "").toLowerCase() != (rule.condition.expectedFieldValue || "").toLowerCase();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Shouldn't the right hand side have the same guard, in case the expected field value is a number? That is - (rule.condition.expectedFieldValue + "" || "")?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rule.condition.expectedFieldValue will always be a string. But i guess you can't be too safe ;)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😉

I'll merge and update the Sync version asap - hopefully tonight :)

@kjac kjac merged commit 5ba6fe1 into kjac:master Aug 4, 2016
@kjac
Copy link
Owner

kjac commented Aug 4, 2016

Thanks! 👍

kjac pushed a commit that referenced this pull request Aug 4, 2016
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.

2 participants