i'm trying to redirect using javascript. I wonder, can I use my own file when redirecting? like for example, I made a sign-up form which validates the input, then if the form is already valid [which means every field is filled up] it will redirect to a page I will call validate.php.

is used:

function validate(thisForm){
			
			with(thisForm){
				
				if( (validate_name(fname)) && (validate_name(lname))){
					window.location="validate.php";
				}else{
					return false;
				}
				
			}
			
		}

but I don't think it's working. I dont know why. please help!

Hi there,

If you had scrolled down a little further on the w3schools page you probably would have noticed the full example which shows you exactly that. :D

Try using <form action="validate.php" onsubmit="validate(this)" method="post"> Good luck,

Traevel

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.