Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

292
Vistas
Uncaught ReferenceError: getBiobank is not defined at HTMLSelectElement.onclick (Rails)

I am using Rails MVC project. I have a javascript function defined as follows in 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',' ')
        }
    }

And in my view, _form.html.haml file I have the following

%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"} 

When I start the server and check click the drop down list, I get the error in browser console as follows

Uncaught ReferenceError: getBiobank is not defined     at HTMLSelectElement.onclick

Is this a scoping issue?. Any hints would be helpful. Thanks!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda