I have a form ‘ChallengeType’. Which has these fields:
1) Embedded form team1
input field username
2) Embedded form team2
input field username
3) Place
a challenge field
4) Date
a challenge field
The username field for each team has been set like this in the TeamType class:
public function buildForm(FormBuilder $builder, array $options)
{
$builder
->add('player_one', 'fos_user_username', array(
'property_path' => false,
'attr' => array('class' => 'player_autocomplete')
))
;
}
Because the property_path is set to false, this username field is unbound.
I would like to validate this field, to make sure that the inputted username is an existing one. How can I do that please?
You can do it by following way