zend framework2 - ZF2 select populate with AJAX -


Hello, I have three dropdowns, the first one is filled in my controller, the second is required to populate with the parameters in the Amazon.

One third and the third one is required when my form validates all the fields, it prints down the error in both the drop downdown. The input is not found in the hessstack

This is my AJAX call

  $ ("# department_id") .change (function () {$ .ajax ({type: "POST ", Url:" & lt ;? php echo $ this-> url ('zfcadmin / getprovinces')>? ", Data:" Dept = "+ $ (this) .val (), success: Function (msg) {$ ("# province_id") .HTML (msg);}}}}};   

This is my controller, am I doing any help wrong?

  public function getProvincesByIDAction () {$ request = $ this- & gt; GetRequest (); $ Response = $ this-> getResponse (); If ($ request-> isPost ()) {$ response- & gt; Set StatusCode (200); $ CodDpto = $ request & gt; getPost ('department'); $ Data = $ this- & gt; Receivable () - & gt; GetProvinces ($ codDpto); $ Buffer = "& lt; option value = '' & gt; Selequen Uña provincia & lt; / option & gt;"; Forex Currency ($ prov $ $ as proof) {$ Buffer. = & lt; & Lt; & Lt; EOT & lt; Option value = '{$ prov- & gt; codProv} '& gt; {$ Prov-> Name} & lt; / Option & gt; EOT; } $ Response- & gt; Set content ($ buffer); $ Headers = $ response- & gt; GetHeaders (); } Returns $ Reaction; }   

Any help?

Thanks

This server side is created when you submit the form This means that the value posted in the value_options statement for each selected element will not be (optionally loaded by AJAX)

error then "no input Was found in grass covered "can be thought of as" the option you chose was not an option in the selected element "

To validate the posted prices you must ensure that you add these options before validation and population on the server side (i.e. first $ form-> set data ($ request- & gt; getPost ()) ) When the form is posted.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -