php - Two forms on the same page - errors messages visibles just in first one -


i have 2 steps forms on different modal each. 3 steps on first 1 (#form1) , same on second 1 (#form2). inputs , elements different names , id. links validation pages (one step)are working. problem errors messages don't appear on second form. made verification error containers id (one id form too). idea why ? try resolve coding array2 of errors form2 no error messages visible.

 $(".step1").click(function() {              var data = {         'data1'   : jquery("input[name=data1]:checked", "#forml").val(),         'data2' : jquery('#data2').val(),         'data3'  : jquery('#data3').val(),         };          jquery.ajax({         url : '/mysite/parsers/check.php',         method : 'post',         type    : 'post',         data : data,         success : function(data){       if (data != 'passed') {         jquery('#list_errors').html(data);         }      if (data.result == 'passed') {         $(".frm").hide("fast");         $("#step2").show("slow");         $(".open1").css("display","none");         $(".open2").css("display","inline-block");        }     },     error : function(){         alert('no working.'); }         });      }); 

that's because you're outputting errors on div using id. id of divs should unique on single page.

what jquery is, updates first div list_errors id , leaves second 1 in second modal is.

solution:

use different ids each or use class of div , access parent() or child() jquery function.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -