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

122
Visualizações
WAMP server local host is not allowing JavaScript code to be functional

I am sorry in advance if this question is confusing but I am very new to web design

So I've downloaded WAMP server in order to build a website and so far I have had a lot success with creating .php and .css files to interact with the MySQL database I have created. However when I try adding JavaScript code to my php files nothing new happens when I open those files in the browser using http://localhost/myFile.php

I have an example here of trying to completely rewrite the text box that appears when my form input is an invalid pattern

php

<!DOCTYPE html> 
<html>
<head>
    <link rel="stylesheet" type="text/css" href="style.css">
    <script type="text/javascript" src="testJS.js"></script>
    <title>Search</title>
</head>
<body>
    <header>Enter Quote Number</header>
    <form action="qSearchResults.php" method="post" >
        <input type="text" name="salesman" id="salesman" maxlength="2" minlength="2" placeholder="01" required="" pattern="[0-9]{2}"/>
        -
        <input type="text" name="year" id="year" maxlength="2" minlenght="2" placeholder="00" required="" pattern="[0-9]{2}"/>
        <input type="text" name="number" id="number" maxlength="4" minlength="4" placeholder="0002" required="" pattern="[0-9]{4}"/>
        <input type="text" name="revision" maxlength="1" placeholder="A" pattern="[A-Za-z]"/>
        <input type="submit" value="Search" 
        onclick="this.form.target='_blank';return true;"/>
    </form>
    
</body>
</html>

JS

var salesmanInput = document.getElementById('salesman');
    salesmanInput.oninvalid = function(event){
        event.target.setCustomValidity('Salesman number should be a two digit number, even if the first digit is 0');
    }

at this point I'm not sure if the problem is my JavaScript code itself, a configuration I need to change with wamp server or a lack of understanding on my part as to how php being server side and JS being client side allows them to interact on my localhost

Any help here would be greatly appreciated, and I will be more than happy to provide whatever else y'all might need in order to help me solve this

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