简体   繁体   English

自定义表单字段symfony / sonata Admin时加载js代码时出现问题

[英]issue loading js code when Customizing form field symfony/ sonata Admin

i'm trying to customise a field of a form generated with sonata admin bundle, i adopted the solution posted here: Customize form field rendering what i want to do also is to execute an autocomplete script with ajax that load for me possible values for the field i've already created, so iwrote the script in the myfield_edit.html.twig mentionned in the solution. 我正在尝试自定义使用Sonata管理员捆绑包生成的表单的字段,我采​​用了此处发布的解决方案: 自定义表单字段的呈现方式我想做的也是用ajax执行自动完成脚本,该脚本会为我加载可能的值我已经创建的字段,所以在解决方案中提到的myfield_edit.html.twig中编写了脚本。 My problem: when loading the form page, my script's never been loaded! 我的问题:加载表单页面时,脚本从未加载过! help pleaze! 帮忙吧!

I think you can try things as seen on this page : http://sonata-project.org/bundles/admin/master/doc/reference/form_types.html 我认为您可以尝试在此页面上看到的内容: http : //sonata-project.org/bundles/admin/master/doc/reference/form_types.html

(see SONATA_TYPE_MODEL_AUTOCOMPLETE) (请参阅SONATA_TYPE_MODEL_AUTOCOMPLETE)

sorry i took two long to answer this question, but finally i convinced my boss to update everything for better use of any package in the future. 抱歉,我花了很长时间回答这个问题,但最终我说服老板更新了所有内容,以便将来更好地使用任何软件包。 now the pain is gone. 现在,痛苦消失了。 thank you all for help. 谢谢大家的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Symfony2 - Sonata Admin - 在字段之前添加javascript - Symfony2 - Sonata Admin - add javascript before field 在树枝中调用javascript(ExtJS)的问题扩展了Sonata管理员树枝/ Symfony 2 - Issue calling javascript (ExtJS) in a twig extended a Sonata admin twig / Symfony 2 Symfony 和奏鸣曲:如何将 javascript 添加到实体管理表单? - Symfony & Sonata : How to add javascript to entity admin form? 自动计算Sonata Admin Bundle中的字段值 - auto calculate field value in sonata Admin Bundle 从Sonata Admin获取表单值 - Get form value from Sonata Admin 具有重定向功能的JS按钮事件(Sonata Admin) - JS button event with redirect (Sonata Admin) jQuery-通过循环的表单域JS代码 - Jquery - Form field JS code through looping 将数据加载到使用JSON返回的表单字段中时出现问题 - Issue while loading data into form field which is returned using JSON 当我使用 Angular Material 和一些自定义它的代码时,如何解决 angular 应用程序中的 $event 问题 - How to solve out the $event issue in angular application when I'm using and Angular Material and some code customizing it 页面加载完成后加载并运行js代码(非干扰性) - Loading and running js code when page loading finished (unobtrusive way)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM