Estoy usando el proyecto Rails MVC. Tengo una función javascript definida de la siguiente manera en assets/application.js
function getBiobank(){ var biobank = document.getElementById('biobank'); var cohort = document.getElementById('cohort'); var biobank_selectedValue = biobank.options[biobank.selectedIndex].value; if (biobank_selectedValue == 'Healthcare Embedded Biobanking' || biobank_selectedValue == 'BMB-CCC' || biobank_selectedValue == 'UKSH Clinic Consent' || biobank_selectedValue == 'BMB-GYN' ){ cohort.options.length = 0; cohort.options[0] = new Option('--Select Cohort',' ') } }Y en mi opinión, el archivo _form.html.haml tengo lo siguiente
%h3 Basic .form-group{class: ("has-error" if @transfer_request.errors.has_key?("Access requested to"))} = f.label "Access requested to", class: "control-label" %br Biomaterial #{f.check_box :access_biomaterial} Data #{f.check_box :access_data} = f.error "Access requested to" = f.input :project_title = javascript_include_tag "application", "data-turbolinks-track" => true = f.input :biobank, collection: TransferRequest.biobanks.keys, prompt: 'Select biobank', :input_html => {:onclick => "getBiobank()", :class => "stext"}Cuando inicio el servidor y verifico hacer clic en la lista desplegable, aparece el siguiente error en la consola del navegador de la siguiente manera
Uncaught ReferenceError: getBiobank is not defined at HTMLSelectElement.onclick¿Es esto un problema de alcance?. Cualquier sugerencia sería útil. ¡Gracias!