javascript - Rails fine-uploader select folder from selectbox -


i try select folders select box , send request fine uploader params. send null. codes below

    //haml codes     - path = "#{rails.root}/public/templates/custom/"     - folders = dir["#{path}*"]     %select#selected_path.form-control{name: 'folder'}       %option{disabled: "disabled", selected: "selected"} select       - folders.each |folder|         %option{value: "#{rails.root + folder}"}           - if file.directory? folder             = folder 

for js code

 $('#fine-uploader-gallery').fineuploader({   template: 'qq-template-gallery',   request: {       endpoint: '/admin/files/upload',       params: {           authenticity_token: "<%= form_authenticity_token %>",           // gecici path eklendi           selected_path: $('#selected_path').change(function() {             alert($('#selected_path option:selected').val());             $('#selected_path option:selected').val()            })        }   } }); 

but above selected_path params give me error. returning js "selected_path"=>"[object htmlselectelement]" error, not path. how can solve this? thank in advance

add haml, onchange

%select#selected_path.form-control{name: 'folder', :onchange => "go()"} 

for js also

 $('#fine-uploader-gallery').fineuploader({  template: 'qq-template-gallery',  request: {   endpoint: '/admin/files/upload',   params: {       authenticity_token: "<%= form_authenticity_token %>",       // gecici path eklendi       selected_path: function go() {               var x = document.getelementbyid('selected_path');               alert(x.value);               return x.value;       }       }    } }); 

solved problem. referenced https://stackoverflow.com/a/11171135/3239403 answer.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -