› Forums › Designer › Feature requests › Validate non-required field only if field is not empty › Reply To: Validate non-required field only if field is not empty
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:
1. ‘Datum in dienst’ and ‘Datum uit dienst’ are both filled in. In this case, ‘Datum in dienst’ must be smaller than ‘Datum uit dienst’.
2. ‘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.