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

Number validation "value is" not working #53

Closed
rasmusfjord opened this issue Aug 5, 2016 · 2 comments
Closed

Number validation "value is" not working #53

rasmusfjord opened this issue Aug 5, 2016 · 2 comments

Comments

@rasmusfjord
Copy link

Hey there :)

We have implemented the async angular part of formeditor into a few of our projects, so far its just been a stellar experience, but we are seeing a thing with "validation" just not working. We have been trying to debug it our selfs, also the reason for @schonert 2 PRs.

We have a form with a few fields in, and 1 validation rule, that a number field must have a value of 10.
image

When we submit the form with out any fields filled out, it will say "Number SKAL være 10" as it should. But when we fill out the field "10" it still says it.

Then when we FORCE through the form, the response we get from the service is :
{"invalidFields":[],"failedValidations":[{"rules":[{"field":{"name":"Number","formSafeName":"_Number","submittedValue":"10","invalid":false},"condition":{"expectedFieldValue":"10","type":"core.fieldvalueis"}}],"errorMessage":"Number SKAL være 10","invalid":true}]}

So it says we submit 10, it expects 10 and its invalid.

We also tried it with an email field which had the validation of "value is" [email protected] which gave the same we submit correct but it throws back an error for us.

Here is the "script" output on the page which also seems stellar:
` var _formDefaultValues = {};
_formDefaultValues._Checkbox_group = ["Option 2"];
_formDefaultValues._Radio_button_group = "Option 1";

  var _formValidations = [{"rules":[{"field":{"name":"Number","formSafeName":"_Number","submittedValue":null,"invalid":false},"condition":{"expectedFieldValue":"10","type":"core.fieldvalueis"}}],"errorMessage":"Number SKAL være 10","invalid":false}];


  var _formId = 1190;


  var _formTotalPages = 1;


  var _formHasReceipt = true;

`

We cannot see the error hope you can, help us (K)Benn Kanobi, your our only hope :)

@kjac
Copy link
Owner

kjac commented Aug 5, 2016

Hey @rasmusfjord,

I think you have it backwards :) for that validation you'll want to use a "Value is not" condition, not "Value is".

But... I understand why you're confused. Actually I am too. The help text isn't exactly helpful, as a matter of fact it is completely wrong. I'll get on that fixed for the next release. It should read something in the lines of "A validation consists of a set of rules to test, and an error message to display if all the rules in the validation are fulfilled." instead of "A validation consists of a set of rules that must be fulfilled, and an error message to display if the rules are not fulfilled."

I haven't tested it with numeric fields, but it works with email fields just fine.

Check these screenshots:

53 - value is not

53 - value is

@rasmusfjord
Copy link
Author

Oh snap yeah that is confusing, no one at our office caught that, i was thinking if we could just rename the conditions to be like "Value must be" 10. Or some other naming because if we all confused the customers will to :)

@kjac kjac closed this as completed in 536df88 Aug 8, 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

No branches or pull requests

2 participants