Dear Triggre-team,
I’ve tried today to create a validation on a non-required datepicker field, which is as follows:
- Form fields / Datum uit dienst != Empty AND Form fields / Datum indiensttreding < Form fields / Datum uit dienst
However, this doesn’t seem to work, since I get the validation even if the ‘Datum uit dienst’ is empty.
I would’ve expected that I’d only get the validation when the form field ‘Datum uit dienst’ actually has a value in it, not when it is empty.
Could you guys check if this is a defect or a mistake in my thinking pattern?
Thanks in advance!
Hello,
Do I understand correctly from your question that you applied the validation rule to the “in dienst”-field? What you’re saying with the rule is that it has to be smaller than the “uit dienst”-field AND the “uit dienst”-field needs to be filled in (you sort of made the “uit dienst”-field required with this rule).
What I think you wanted was: Form fields / Datum uit dienst = Empty OR Form fields / Datum indiensttreding < Form fields / Datum uit dienst . That means that if the “uit dienst”-field is empty, it doesn’t matter what is filled in in the “in dienst”-field. But if something is filled in in the “uit dienst”-field, it needs to be bigger than the “in dienst”-field.
Hi,
Well, I tried to apply the validation to the ‘Datum uit dienst’ field, not the ‘Datum indiensttreding’ (since that one is required, and ‘Datum uit dienst’ is not required).
However, I changed the validationrule now to: Datum uit dienst > Datum indiensttreding AND Datum uit dienst != emtpy
This doesn’t seem to work either, since it triggres the validation as well when the ‘Datum uit dienst’ is empty.
Please let me know how to fix this. Thanks in advance!
Form field validation rules are checked when anything valid is entered in a field. For optional fields, filling in nothing is valid, so the rule is checked. Anything that is in the form field needs to comply with the rule in order to be accepted. In your rule you say the following is accepted: “‘datum uit dienst’ must be larger than ‘datum in dienst’ and ‘datum uit dienst’ must not be empty”. So leaving the field blank is not accepted by the rule.
If I understand correctly, you want to accept the following cases:
-
‘Datum in dienst’ and ‘Datum uit dienst’ are both filled in. In this case, ‘Datum in dienst’ must be smaller than ‘Datum uit dienst’.
-
‘Datum uit dienst’ is left blank.
If either is the case, you accept the input, or in other words: you accept either case 1 or case 2. Your rule then becomes:
Form fields / Datum indiensttreding < Form fields / Datum uit dienst OR Form fields / Datum uit dienst = Empty
If I’m misunderstanding what you want or do a terrible job explaining it, please let me know. In this case the field you put this rule on doesn’t make a difference for what data is accepted.