P
P
prozrost2017-08-18 12:01:49
symfony
prozrost, 2017-08-18 12:01:49

Validation with Expression, how?

There are 3 fields. I want to validate like this: If there is the first-2 and 3 are not available and vice versa, there are 2 and 3, then the first is available. I'm doing this for now:

<constraint name="Expression">
                <option name="expression">
                     this.getOrganization () === null and value !== null
                </option>
                <option name="message">
                    Don't work of Organization or fill this field
                </option>
            </constraint>

The problem is that it validates even when this field does not exist, that is, as I understand it, the value==null condition is executed and that's it, validation error.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2017-08-18
@prozrost

There are 3 fields. I want to validate like this: If there is the first-2 and 3 are not available and vice versa, there are 2 and 3, then the first is not available.

a or (b and c)
// a
(this.b and this.c) or value

// b
this.a or (this.c and value)

// c
this.a or (this.b and value)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question