php - pre_set_data and post_submit form event -


I have two lists in my form: "State" and "country" state list depend on the country list. I handle it with the events of the form and according to the doctor, I need two events: pre_set_data and post_submit Here, my code is the type of my form here:

form code = $ formModifier = function , Country $ country) ($ option) {// countryID query to get all states}}

1 / initialization

  $ builder-> addEventListener (FormEvents :: PRE_SET_DATA, use the function (FormEvent $ event) {$ formModifier} {$ country = ..; $ formModifier ($ event- & gt; getForm, $ country);}  

2 / post handler submit

  $ builder-> ('Country') -> Use the Advent Listener (FormEvant :: POST_SUBMIT, Function (event $ Event) ($ form modifier) ​​{$ formModifier ($ event- & gt; getForm () - & gt; getParent () , $ Event- & gt; GetForm () - & gt; GetData ())}}}  

Everything works fine, except for the submission of the form pre_set_data is called and post_submit also happens. My query is called twice in the $ FormModifier function. / P>

This is normal. Both incidents happen, so both listeners are active, calling their function $ formModifier ... then the function is called twice.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -