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