diff --git a/rapids/templates/rapids/rapid_form.html b/rapids/templates/rapids/rapid_form.html index cfbadf1a..fa0afc02 100755 --- a/rapids/templates/rapids/rapid_form.html +++ b/rapids/templates/rapids/rapid_form.html @@ -27,7 +27,7 @@ function add_input_form() { var form_idx = $('#id_images-TOTAL_FORMS').val(); - $('#image_form_set').append($('#empty_form').html().replace(/__prefix__/g, form_idx)); + $('#image_form_set').append($('#empty_form').html().replace(/__prefix__/g, form_idx).on("change", input_change)); $('#id_images-TOTAL_FORMS').val(parseInt(form_idx) + 1); } @@ -38,6 +38,16 @@ $('#id_answers-TOTAL_FORMS').val(parseInt(form_idx) + 1); } + function input_change () { + $(this).removeClass("image-ident-warning"); + $(this).removeClass("image-ident-ok"); + updateFileList(); + console.log("input change1"); + console.log("input change", this); + ocr(this); + + } + $(document).ready(function () { $("#add_abnormality").appendTo($("label[for='id_abnormality']")); @@ -149,14 +159,7 @@ } - $("input[type=file]").on('change', function () { - $(this).removeClass("image-ident-warning"); - $(this).removeClass("image-ident-ok"); - updateFileList(); - console.log("input change1"); - console.log("input change", this); - ocr(this); - }); + $("input[type=file]").on('change', input_change);