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

Recommended Answers

All 2 Replies

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.

commented: Kudos ! +7
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.