Enterprise form custom validator based on another field

I am trying to create a custom validator for eform field. This validator needs to work based on the value from previous field(example, phone number and confirm phone number filed). I am referring:

In code, how do I refer another field from same form and same group to achieve this?