Open JohnBlazek opened 8 years ago
I added a custom rule for this for the time being because I did not want to fall back to the HTML5 validation.
Formsy.addValidationRule('isRequired', (values, value) => {
return value && value.toString().trim().length;
});
@Semigradsky Is this not what the isDefaultRequiredValue()
validation is for? Although it is missing some cases (whitespace, null
)..
@lennardschutter i had the same issue with null
cases being let through
I think I ran in to the same issue this week. Might look at creating a pull request.
On 7 Feb 2017, at 7:02 pm, Awwab Ul Haq notifications@github.com wrote:
@lennardschutter i had the same issue with null cases being let through
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
I'm looking for a way to check and see if a field I'm editing is both required and matches a certain condition within a validation rule. I'm noticing there is no validation rule that checks to see if a field is required. I would be looking to see if the field is required from the tag itself...
something like:
Formsy.addValidationRule('equalsFieldAndRequired', function (values, value, field) { return value === values[field] && this.isRequired();
});
Hope this makes sense!