Validate a field depending on another field value in Symfony

前端 未结 1 1183
-上瘾入骨i
-上瘾入骨i 2021-01-21 00:23

I have two related fields in a Symfony form: object_status and cryopreservation_method.

The first one cannot be null and stores one of three p

1条回答
  •  一生所求
    2021-01-21 00:34

    You have to create a conditional validator. This can be done using a sfValidatorCallback (easier than creating a new validator). Check this example of the Symfony Cookbook (is for 1.2 but works in 1.4).

    0 讨论(0)
提交回复
热议问题