- 3,341
So here's the deal, currently I am writing a php/sqlite CMS system and I am using some JavaScript to do some form checking before sending the data off to the server for processing. The problem I am running into is my JS code has just stopped working for the most part
this is what the script boils down to
Javascript
Form code
So if any tag within the Installer form trips an empty value, the form doesn't submit. The problem I am having is that exact code was working for me two days ago, the only thing I have changed is adding some more IF checks for some other form values, and I know they are being checked as leaving them empty throws the alert box, but even though the form is getting a false returned to it, it still gets submitted.
This is frustrating because I can do full OOP programming in php, the whole backend of my CMS is module based and miles more complex, but this little js code doesn't work. What gets me even more I am trying to keep all the code in this as 100% my own, so I really don't want to go out and grab some bloated form validators, when this code is more than enough for my needs.
So are there any JS gurus that can help me?
this is what the script boils down to
Javascript
Code:
function check_install()
{
valid = true;
if( document.Installer.AdminName.value == "" )
{
alert("Administrator Name Is Empty");
valid = false;
}
return valid;
}
Code:
<form name="Installer" action="installer.php?action=runInstall" method="post" onsubmit="return check_install();">
<input type="text" name="AdminName" />
<input type="submit" name="submit" value="Install" />
</form>
This is frustrating because I can do full OOP programming in php, the whole backend of my CMS is module based and miles more complex, but this little js code doesn't work. What gets me even more I am trying to keep all the code in this as 100% my own, so I really don't want to go out and grab some bloated form validators, when this code is more than enough for my needs.
So are there any JS gurus that can help me?