I do not have any JS error in my console, even when I validate the form, and the twig functions seems to initialize the plugin for my form without any error. Here is the JS generated on my page after loading it in my browser :
<script src="/bundles/fpjsformvalidator/js/FpJsFormValidator.js" type="text/javascript"></script>
<script src="/bundles/fpjsformvalidator/js/jquery.fpjsformvalidator.js" type="text/javascript"></script>
<script type="text/javascript">FpJsFormValidator.config = {'routing':{'check_unique_entity':'/app_dev.php/fp_js_form_validator/check_unique_entity'}};</script>
<script type="text/javascript">FpJsFormValidator.addModel({'id':'form','name':'form','type':'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType','invalidMessage':'Cette valeur n\'est pas valide.','bubbling':true,'data':[],'transformers':[],'children':[],'prototype':null}, true);
FpJsFormValidator.addModel({'id':'advercity_adminbundle_user','name':'advercity_adminbundle_user','type':'Advercity\\AdminBundle\\Form\\UserType','invalidMessage':'Cette valeur n\'est pas valide.','bubbling':true,'data':{'entity':{'constraints':{'Fp\\JsFormValidatorBundle\\Form\\Constraint\\UniqueEntity':[{'entityName':'Advercity\\AdminBundle\\Entity\\User','message':'Le nom d\'utilisateur est déjà utilisé.','service':'doctrine.orm.validator.unique','em':null,'entityClass':null,'repositoryMethod':'findBy','fields':'usernameCanonical','errorPath':'username','ignoreNull':true,'payload':null,'groups':['Registration','Profile']},{'entityName':'Advercity\\AdminBundle\\Entity\\User','message':'L\'adresse e-mail est déjà utilisée.','service':'doctrine.orm.validator.unique','em':null,'entityClass':null,'repositoryMethod':'findBy','fields':'emailCanonical','errorPath':'email','ignoreNull':true,'payload':null,'groups':['Registration','Profile']}]},'groups':['Default']}},'transformers':[],'children':{'username':{'id':'advercity_adminbundle_user_username','name':'username','type':'Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType','invalidMessage':'Cette valeur n\'est pas valide.','bubbling':false,'data':{'parent':{'constraints':{'Symfony\\Component\\Validator\\Constraints\\NotBlank':[{'message':'Entrez un nom d\'utilisateur s\'il vous plait.','payload':null,'groups':['Registration','Profile']}],'Symfony\\Component\\Validator\\Constraints\\Length':[{'maxMessage':'Le nom d\'utilisateur est trop long.','minMessage':'Le nom d\'utilisateur est trop court.','exactMessage':'Cette chaine doit avoir exactement {{ limit }} caractère.|Cette chaine doit avoir exactement {{ limit }} caractères.','charsetMessage':'Cette valeur ne correspond pas au jeu de caractères {{ charset }} attendu.','max':180,'min':2,'charset':'UTF-8','payload':null,'groups':['Registration','Profile']}]},'groups':['Default']},'form':{'constraints':{'Symfony\\Component\\Validator\\Constraints\\Length':[{'maxMessage':'Cette chaine est trop longue. Elle doit avoir au maximum {{ limit }} caractère.|Cette chaine est trop longue. Elle doit avoir au maximum {{ limit }} caractères.','minMessage':'Cette chaine est trop courte. Elle doit avoir au minimum {{ limit }} caractère.|Cette chaine est trop courte. Elle doit avoir au minimum {{ limit }} caractères.','exactMessage':'Cette chaine doit avoir exactement {{ limit }} caractère.|Cette chaine doit avoir exactement {{ limit }} caractères.','charsetMessage':'Cette valeur ne correspond pas au jeu de caractères {{ charset }} attendu.','max':10,'min':5,'charset':'UTF-8','payload':null,'groups':['Default']}]},'groups':['Default']}},'transformers':[],'children':[],'prototype':null},'email':{'id':'advercity_adminbundle_user_email','name':'email','type':'Symfony\\Component\\Form\\Extension\\Core\\Type\\EmailType','invalidMessage':'Cette valeur n\'est pas valide.','bubbling':false,'data':{'parent':{'constraints':{'Symfony\\Component\\Validator\\Constraints\\NotBlank':[{'message':'Entrez une adresse e-mail s\'il vous plait.','payload':null,'groups':['Registration','Profile']}],'Symfony\\Component\\Validator\\Constraints\\Length':[{'maxMessage':'L\'adresse e-mail est trop longue.','minMessage':'L\'adresse e-mail est trop courte.','exactMessage':'Cette chaine doit avoir exactement {{ limit }} caractère.|Cette chaine doit avoir exactement {{ limit }} caractères.','charsetMessage':'Cette valeur ne correspond pas au jeu de caractères {{ charset }} attendu.','max':180,'min':2,'charset':'UTF-8','payload':null,'groups':['Registration','Profile']}],'Symfony\\Component\\Validator\\Constraints\\Email':[{'message':'L\'adresse e-mail est invalide.','checkMX':false,'checkHost':false,'strict':null,'payload':null,'groups':['Registration','Profile']}]},'groups':['Default']},'form':{'constraints':{'Symfony\\Component\\Validator\\Constraints\\Email':[{'message':'Cette valeur n\'est pas une adresse email valide.','checkMX':false,'checkHost':false,'strict':false,'payload':null,'groups':['Default']}]},'groups':['Default']}},'transformers':[],'children':[],'prototype':null},'plainPassword':{'id':'advercity_adminbundle_user_plainPassword','name':'plainPassword','type':'Symfony\\Component\\Form\\Extension\\Core\\Type\\RepeatedType','invalidMessage':'label.passwords_must_match','bubbling':false,'data':{'parent':{'constraints':{'Symfony\\Component\\Validator\\Constraints\\NotBlank':[{'message':'Entrez un mot de passe s\'il vous plait.','payload':null,'groups':['Registration','ResetPassword','ChangePassword']}],'Symfony\\Component\\Validator\\Constraints\\Length':[{'maxMessage':'Cette chaine est trop longue. Elle doit avoir au maximum {{ limit }} caractère.|Cette chaine est trop longue. Elle doit avoir au maximum {{ limit }} caractères.','minMessage':'Le mot de passe est trop court.','exactMessage':'Cette chaine doit avoir exactement {{ limit }} caractère.|Cette chaine doit avoir exactement {{ limit }} caractères.','charsetMessage':'Cette valeur ne correspond pas au jeu de caractères {{ charset }} attendu.','max':4096,'min':2,'charset':'UTF-8','payload':null,'groups':['Registration','Profile','ResetPassword','ChangePassword']}]},'groups':['Default']}},'transformers':[{'keys':['first','second'],'name':'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\ValueToDuplicatesTransformer'}],'children':{'first':{'id':'advercity_adminbundle_user_plainPassword_first','name':'first','type':'Symfony\\Component\\Form\\Extension\\Core\\Type\\PasswordType','invalidMessage':'Cette valeur n\'est pas valide.','bubbling':false,'data':{'form':{'constraints':{'Symfony\\Component\\Validator\\Constraints\\Length':[{'maxMessage':'Cette chaine est trop longue. Elle doit avoir au maximum {{ limit }} caractère.|Cette chaine est trop longue. Elle doit avoir au maximum {{ limit }} caractères.','minMessage':'Cette chaine est trop courte. Elle doit avoir au minimum {{ limit }} caractère.|Cette chaine est trop courte. Elle doit avoir au minimum {{ limit }} caractères.','exactMessage':'Cette chaine doit avoir exactement {{ limit }} caractère.|Cette chaine doit avoir exactement {{ limit }} caractères.','charsetMessage':'Cette valeur ne correspond pas au jeu de caractères {{ charset }} attendu.','max':null,'min':6,'charset':'UTF-8','payload':null,'groups':['Default']}]},'groups':['Default']}},'transformers':[],'children':[],'prototype':null},'second':{'id':'advercity_adminbundle_user_plainPassword_second','name':'second','type':'Symfony\\Component\\Form\\Extension\\Core\\Type\\PasswordType','invalidMessage':'Cette valeur n\'est pas valide.','bubbling':false,'data':[],'transformers':[],'children':[],'prototype':null}},'prototype':null},'avatarImageFile':{'id':'advercity_adminbundle_user_avatarImageFile','name':'avatarImageFile','type':'Symfony\\Component\\Form\\Extension\\Core\\Type\\FileType','invalidMessage':'Cette valeur n\'est pas valide.','bubbling':false,'data':[],'transformers':[],'children':[],'prototype':null}},'prototype':null}, true);</script>
Note : I embedded it into an AdminLTE layout, provided by AvanzuAdminThemeBundle , but like I said I do not have JS errors or conflicts.
Also I tried to put the JS code in the bottom of my layout instead of putting it in the <head> section
Hi everyone !
I installed the bundle and it seems the JS validation is not working :/ I am on a project using Symfony 3.3.2.
Because the "fp_js_validator.js" is missing, I added the following code to my template :
I do not have any JS error in my console, even when I validate the form, and the twig functions seems to initialize the plugin for my form without any error. Here is the JS generated on my page after loading it in my browser :
Note : I embedded it into an AdminLTE layout, provided by AvanzuAdminThemeBundle , but like I said I do not have JS errors or conflicts. Also I tried to put the JS code in the bottom of my layout instead of putting it in the
<head>
sectionAnyone could help ?