hi
the register.php file is in the root directory, validateform.js file is also in the root directory and confirmregister.php is in a folder called php in the root directory.
i am calling the javascript file in register.php in the following way
<script lanaguage="javascript" type="text/javascript" src="validateform.js">
</script>
in confirm.php i have called the javascript file in the following ways
1.
<script lanaguage="javascript" type="text/javascript" src="http://website.com/php/validateform.js">
</script>
2.
<script lanaguage="javascript" type="text/javascript" src="../validateform.js">
</script>
3.
also i have removed the script tag and copied the entire javascript code into confirm.php file
in both register.php and confirm.php following is the form tag
<form id="form1" name="registrationform" method="post" action="http://website.com/php/confirm.php" onSubmit="return validateform()">
and this validateform() function is defined in the javascript file
none of the above 3 methods are working, i have tried these 3 options several times but they do not work.
i am able to call the javascript file from confirm.php now, the problem is the javascript code is not being read. i used an alert statement after the validateform() function at the begining and an alert at the end of the validateform() function, only the first alert is being called and the rest of the javascript code is being ignored, even the last alert message is not being called and the confirm.php file is being called.
what i have noticed and might be the problem is, in register.php the form fields are defined as follows
<input type="text" name="username"> and for the rest in the same manner however in confirm.php the form fields are defined as follows
echo "<input type =\"text\" name=\"username\" value=\"$username\">"; and so on for the others.
since the form elements are now different from how it is defined in register.php i am thinking that this is the reason why the javascript code is being ignored as the way the form elements are defined is NOT <input type="text" name="username"> which is the convention. so i guess in confirm.php file i need to let the php file know that echo "<input type =\"text\" name=\"username\" value=\"$username\">"; is equivalent to <input type="text" name="username"> for the javascript code to work in confirm.php file.
please advice if this is the problem or if there is any other solution and how the code should be written.
NOTE= in confirm.php file i want to display to the user what they have entered in register.php so that they can review the information and then click on register button.
if there is no solution i am think of making all the fields as read only in confirm.php and i should advice the users in confirm.php to click on the back button to make changes in register.php
any help will be greatly appreciated.
thanks.