Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

299
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda