0

Hi

I have a PHP page with the following JavaScript and HTML Form, but when I click on the Continue button nothing happens. The action="this_page.php" means that when the Continue button was pressed, prior to adding the Validation bit, would run itself as there is quiet a bit of PHP code at the top of the page.

JavaScript

<script type="text/javascript">
function checkForm() {
	alert('You have arrived at the Function!');
}

HTML Form

<form onSubmit="return checkForm()" name="form" class="form" method="post" action="this_page.php">

If I take out the "onSubmit" code, the script works as it always did. So does that mean that you cannot have an "onSubmit" as well as an "Action" in the form header?

The reason for the validation is that the form has three sets of Inputs (See my previous post) so the JavaScript is need to make sure that there is data in only one input.

Then the PHP code is run, and of course, and what happens depends on what the user has input.

So what I would really like to know is how I can get JavaScript to check what the user has input, and then do the "Action" bit so the PHP can be run.

At the moment, as I have said, when I click on the Continue button absolutely nothing happens. The form just stays as it was.

Thanks

2
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by terrymold
1

Hi pritaeas

Although the problem in your thread wasn't the same as mine, I was able to determine from it where I had gone wrong.

So, thanks for that. And all is good again.

Votes + Comments
Kudos !
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.