]> _ Git - cubist_cms-back.git/commitdiff
wip #7930 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 8 Jan 2026 13:59:42 +0000 (14:59 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 8 Jan 2026 13:59:42 +0000 (14:59 +0100)
src/resources/views/fields/hiddenfilestandaloneform.blade.php

index a01a3b28b7af4086a8a712542723791a2dc6b02e..809de8f89ec466ee16ca2c2d63218c6267e12bf5 100644 (file)
@@ -5,6 +5,7 @@
 @push('before_scripts')
     <form style="visibility: hidden;" method="post" id="{!! $id !!}" enctype="multipart/form-data"
           action="{{$field['action']}}">
+        @csrf
         <input type="file" @if($field['multiple'])name="file[]" multiple="multiple" @else name="file" @endif />
     </form>
 @endpush
         <script>
             $(function () {
                 $('{!! $field['trigger'] !!}').on('click', function () {
-                    $("#{!! $id !!}").find('input').get(0).click();
+                    $("#{!! $id !!}").find('input[type="file"]').get(0).click();
                     return false;
                 });
 
                 $("#{!! $id !!} input").on('change', function () {
-                    $("#{!! $id !!}").submit();
-                })
+                    var form = $("#{!! $id !!}");
+                    var f = $(form).ajaxSubmit({dataType: 'json'});
+                    var xhr = f.data('jqxhr');
+                    xhr.done(function (data) {
+                        console.log(data);
+                    });
+                });
             });
         </script>
     @endpush