I am new to Netbeans. I have created a simple php project. It consists of a form and I've written a separate Javascript file to validate its fields. I tried running the project outside netbeans, it works fine. I recently imported the project to netbeans but javascript doesn't seem to work well. When I try opening the page(form page) in the browser, the entire javascript file appears on the page.
I do not know where I'm going wrong. As I'm new to netbeans I am unable to rectify it. Kindly help.
My Javascript file is named Validation.js and is in the js folder.
function ValidateForm(theForm)
{
//returns true/false after validation
}
My php file looks similar to this.
<?php include "js/Validation.js";
//if validation returns true
if(isset($_POST))
{
if(isset ($_POST['bt_save']) && $_POST['bt_save'] == 'Submit')
{
//code to insert fields into database after validation
}
}
?>
<form method="post" name="form1" id="form1" onsubmit="return ValidateForm(this);">
<!--form elements-->
<input type="submit" name="bt_save" value="Submit"/>
</form>
Thanks in advance!