title: Auto populate dropdown fields doesn't work
body: <p>I have 2 drop down fields which both auto populated.</p>
  <p><strong>Example :</strong></p>
  <blockquote>
  <p>car_model -&gt; dropdown_field1</p>
  <p>car_model_variants -&gt; dropdown_field2</p>
  </blockquote>
  <p>When I select a model in <code>car_model</code> field, <code>car_model_variants</code> must update its values.</p>
  <p>In my case, I have index.php where you can click a button that will show the modal box and you'll find the auto populated drop down fields.</p>
  <p>First attempt, when selecting a <code>car_model</code> it works the <code>car_model_variants</code> field is updating its values. But it doesn't work if I submit a form when <code>car_model_variants</code> is empty, If I try to select a <code>car_model</code> again? the dropdown 2 field is not updating. Below is my code.</p>
  <pre><code>(function ($) {
      $('.edit').formPopup({
          'modalParams': {
              'parent_container': $('div.autodeal')
          },
          'callback': function (settings)
          {
              $('.modal')
                      .addClass('large')
                      .css({'z-index': 101});
  
  
              $('#used_car_car_model').change(function () {
                  var select = $(this);
  
                  $.ajax({
                      'url': '{{ path(&quot;autodeal_backend_filter_select&quot;) }}',
                      'data': {'carModelId': select.val(), 'carGuideOnly': 0, 'isVerified': 1, 'showCompleteName': 1},
                      success: function (html)
                      {
                          $('#used_car_car_model_variant').html(html);
                      }
                  });
              });
          },
          'formSubmitParams': {
              'retainFormUrl': false,
              'submit_callback': function ()
              {
                  window.location.reload();
              },
              'error_callback': function (form, settings)
              {
                  $('.close, .exit', $(settings.container))
                          .click(function () {
                              window.location.reload();
                          });
              }
          }
      });
  })(jQuery);
  </code></pre>
  <p>Here's the full code.</p>
  <pre><code>&lt;form novalidate=&quot;&quot; action=&quot;/app_dev.php/used-car-listings/164/edit&quot; method=&quot;POST&quot;&gt;
  &lt;div class=&quot;marginbottom row gutters&quot;&gt;
      &lt;div class=&quot;col span_12&quot;&gt;
          &lt;div&gt;
              &lt;div&gt;
                  &lt;label for=&quot;used_car_plate_number&quot; class=&quot;required&quot;&gt;Plate number&lt;/label&gt;                                        
                  &lt;input type=&quot;text&quot; id=&quot;used_car_plate_number&quot; name=&quot;used_car[plate_number]&quot; required=&quot;required&quot; value=&quot;GS0909&quot;&gt;
              &lt;/div&gt;
              &lt;div&gt;
                  &lt;label for=&quot;used_car_year&quot; class=&quot;required&quot;&gt;Year&lt;/label&gt;
                  &lt;input type=&quot;text&quot; id=&quot;used_car_year&quot; name=&quot;used_car[year]&quot; required=&quot;required&quot; value=&quot;2015&quot;&gt;
              &lt;/div&gt;
              &lt;div&gt;
                  &lt;label for=&quot;used_car_car_model&quot; class=&quot;required&quot;&gt;Car Model&lt;/label&gt;
                  &lt;select id=&quot;used_car_car_model&quot; name=&quot;used_car[car_model]&quot; required=&quot;required&quot;&gt;
                  &lt;option value=&quot;&quot;&gt;Select A Model&lt;/option&gt;&lt;option value=&quot;102&quot;&gt;Mercedes-Benz A-Class&lt;/option&gt;&lt;option value=&quot;401&quot; selected=&quot;selected&quot;&gt;Mercedes-Benz AMG&lt;/option&gt;&lt;option value=&quot;103&quot;&gt;Mercedes-Benz B-Class&lt;/option&gt;&lt;option value=&quot;105&quot;&gt;Mercedes-Benz C-Class Coupe&lt;/option&gt;&lt;option value=&quot;104&quot;&gt;Mercedes-Benz C-Class Sedan&lt;/option&gt;&lt;option value=&quot;115&quot;&gt;Mercedes-Benz CLA-Class&lt;/option&gt;&lt;option value=&quot;576&quot;&gt;Mercedes-Benz CLC-Class&lt;/option&gt;&lt;option value=&quot;577&quot;&gt;Mercedes-Benz CLK-Class&lt;/option&gt;&lt;option value=&quot;106&quot;&gt;Mercedes-Benz CLS-Class&lt;/option&gt;&lt;option value=&quot;107&quot;&gt;Mercedes-Benz E-Class&lt;/option&gt;&lt;option value=&quot;578&quot;&gt;Mercedes-Benz G-Class&lt;/option&gt;&lt;option value=&quot;108&quot;&gt;Mercedes-Benz GL-Class&lt;/option&gt;&lt;option value=&quot;109&quot;&gt;Mercedes-Benz GLK-Class&lt;/option&gt;&lt;option value=&quot;110&quot;&gt;Mercedes-Benz M-Class&lt;/option&gt;&lt;option value=&quot;111&quot;&gt;Mercedes-Benz S-Class&lt;/option&gt;&lt;option value=&quot;112&quot;&gt;Mercedes-Benz SL-Class&lt;/option&gt;&lt;option value=&quot;113&quot;&gt;Mercedes-Benz SLK-Class&lt;/option&gt;&lt;option value=&quot;114&quot;&gt;Mercedes-Benz SLS-Class&lt;/option&gt;&lt;option value=&quot;579&quot;&gt;Mercedes-Benz Viano&lt;/option&gt;&lt;/select&gt;
              &lt;/div&gt;
              &lt;div&gt;
                  &lt;label for=&quot;used_car_car_model_variant&quot; class=&quot;required&quot;&gt;Car Model Variant&lt;/label&gt;
                  &lt;select id=&quot;used_car_car_model_variant&quot; name=&quot;used_car[car_model_variant]&quot; required=&quot;required&quot;&gt;&lt;option value=&quot;&quot;&gt;Select Mercedes-Benz A-Class Variant&lt;/option&gt;&lt;option value=&quot;343&quot;&gt;2014 Mercedes-Benz A-Class A 250 Sport 4MATIC&lt;/option&gt;&lt;option value=&quot;344&quot;&gt;2014 Mercedes-Benz A-Class A 45 AMG&lt;/option&gt;&lt;/select&gt;
              &lt;/div&gt;
              &lt;div&gt;
                  &lt;label for=&quot;used_car_mileage&quot; class=&quot;required&quot;&gt;Mileage&lt;/label&gt;
                  &lt;input type=&quot;text&quot; id=&quot;used_car_mileage&quot; name=&quot;used_car[mileage]&quot; required=&quot;required&quot; value=&quot;1700&quot;&gt;
              &lt;/div&gt;
              &lt;div&gt;
                  &lt;label for=&quot;used_car_price&quot; class=&quot;required&quot;&gt;Price&lt;/label&gt;
                  &lt;input type=&quot;text&quot; id=&quot;used_car_price&quot; name=&quot;used_car[price]&quot; required=&quot;required&quot; value=&quot;3288300&quot;&gt;
              &lt;/div&gt;
              &lt;div&gt;
                  &lt;label for=&quot;used_car_used_car_color&quot; class=&quot;required&quot;&gt;Color&lt;/label&gt;
                  &lt;select id=&quot;used_car_used_car_color&quot; name=&quot;used_car[used_car_color]&quot; required=&quot;required&quot;&gt;
                  &lt;option value=&quot;&quot;&gt;Select A Color&lt;/option&gt;&lt;option value=&quot;1&quot;&gt;Red&lt;/option&gt;&lt;option value=&quot;2&quot;&gt;Blue&lt;/option&gt;&lt;option value=&quot;3&quot;&gt;Black&lt;/option&gt;&lt;option value=&quot;4&quot;&gt;White&lt;/option&gt;&lt;option value=&quot;5&quot;&gt;Green&lt;/option&gt;&lt;option value=&quot;6&quot;&gt;Silver&lt;/option&gt;&lt;option value=&quot;7&quot; selected=&quot;selected&quot;&gt;Grey&lt;/option&gt;&lt;option value=&quot;8&quot;&gt;Yellow&lt;/option&gt;&lt;option value=&quot;9&quot;&gt;Brown&lt;/option&gt;&lt;option value=&quot;10&quot;&gt;Beige&lt;/option&gt;&lt;option value=&quot;11&quot;&gt;Orange&lt;/option&gt;&lt;option value=&quot;12&quot;&gt;Purple&lt;/option&gt;&lt;option value=&quot;13&quot;&gt;Pink&lt;/option&gt;&lt;option value=&quot;14&quot;&gt;Turquoise&lt;/option&gt;&lt;option value=&quot;15&quot;&gt;Bronze&lt;/option&gt;&lt;/select&gt;
              &lt;/div&gt;
              &lt;div&gt;
                  &lt;label for=&quot;used_car_description&quot; class=&quot;required&quot;&gt;Description&lt;/label&gt;
                  &lt;textarea id=&quot;used_car_description&quot; name=&quot;used_car[description]&quot; required=&quot;required&quot; cols=&quot;4&quot; rows=&quot;3&quot;&gt;Body color, Tenorite Gray&lt;/textarea&gt;
              &lt;/div&gt;
              &lt;div&gt;
                  &lt;label class=&quot;required&quot;&gt;City&lt;/label&gt;
                  &lt;input type=&quot;hidden&quot; id=&quot;used_car_city_id&quot; name=&quot;used_car[city][id]&quot; value=&quot;20&quot;&gt;&lt;input type=&quot;text&quot; id=&quot;used_car_city_text&quot; name=&quot;used_car[city][text]&quot; required=&quot;required&quot; autocomplete=&quot;off&quot; value=&quot;San Juan, Metro Manila&quot;&gt;
              &lt;/div&gt;
              &lt;div&gt;
                  &lt;label class=&quot;required&quot;&gt;Is service record submitted&lt;/label&gt;
                  &lt;div id=&quot;used_car_is_service_record_submitted&quot;&gt;&lt;label class=&quot;marginleft marginright&quot;&gt;&lt;input type=&quot;radio&quot; id=&quot;used_car_is_service_record_submitted_0&quot; name=&quot;used_car[is_service_record_submitted]&quot; required=&quot;required&quot; value=&quot;1&quot;&gt;Yes
                  &lt;/label&gt;&lt;label class=&quot;marginleft marginright&quot;&gt;&lt;input type=&quot;radio&quot; id=&quot;used_car_is_service_record_submitted_1&quot; name=&quot;used_car[is_service_record_submitted]&quot; required=&quot;required&quot; value=&quot;0&quot; checked=&quot;checked&quot;&gt;No&lt;/label&gt;&lt;/div&gt;
              &lt;/div&gt;
              &lt;div&gt;
                  &lt;label class=&quot;required&quot;&gt;Is LTO verified&lt;/label&gt;
                  &lt;div id=&quot;used_car_is_lto_verified&quot;&gt;&lt;label class=&quot;marginleft marginright&quot;&gt;&lt;input type=&quot;radio&quot; id=&quot;used_car_is_lto_verified_0&quot; name=&quot;used_car[is_lto_verified]&quot; required=&quot;required&quot; value=&quot;1&quot; checked=&quot;checked&quot;&gt;Yes
                  &lt;/label&gt;&lt;label class=&quot;marginleft marginright&quot;&gt;&lt;input type=&quot;radio&quot; id=&quot;used_car_is_lto_verified_1&quot; name=&quot;used_car[is_lto_verified]&quot; required=&quot;required&quot; value=&quot;0&quot;&gt;No
                  &lt;/label&gt;&lt;/div&gt;
              &lt;/div&gt;
          &lt;div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;input type=&quot;hidden&quot; id=&quot;used_car__token&quot; name=&quot;used_car[_token]&quot; value=&quot;4e4UOHBr5SmtV7Pb0WoWv4xSz90LoVarNG8hw0dy_RY&quot;&gt;            &lt;hr class=&quot;nomargin marginbottom30 margintop20&quot;&gt;
       &lt;div class=&quot;row&quot;&gt;
          &lt;button type=&quot;submit&quot; class=&quot;button&quot;&gt;Save&lt;/button&gt;
       &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>