javascript - Multiple file upload/submit forms -
i have single page multiple file upload forms. generated in loop.
problem: first file upload control works, , rest don't.
<div> <form action="/docs/1046/uploaddocument?id=1046&propertytypeid=1" enctype="multipart/form-data" method="post"> <input name="x-http-method-override" type="hidden" value="put"> <div style="display: none"> <label for="filecommercial_transport_license"></label> <input id="filecommercial_transport_license" name="filecommercial_transport_license" type="file" onchange=" $('#btnsubmitdata').click(); "> <input id="btnsubmitdata" type="submit" onclick=" txt = $('#filecommercial_transport_license').val(); alert(txt); "> </div> <div> <label> document 1: </label> <button type="button" onclick=" $('#filecommercial_transport_license').click(); ">upload 1</button> </div> </form> <form action="/docs/1046/uploaddocument?id=1046&propertytypeid=5" enctype="multipart/form-data" method="post"> <input name="x-http-method-override" type="hidden" value="put"> <div style="display: none"> <label for="fileclean_criminal_record"></label> <input id="fileclean_criminal_record" name="fileclean_criminal_record" type="file" onchange=" $('#btnsubmitdata').click(); "> <input id="btnsubmitdata" type="submit" onclick=" txt = $('#fileclean_criminal_record').val(); alert(txt); "> </div> <div> <label> document 2: </label> <button type="button" onclick=" $('#fileclean_criminal_record').click(); ">upload 2</button> </div> </form> </div>
make id #btnsubmitdata unique. should fix problem.
Comments
Post a Comment