there is a javascript post problem in my page .... help me..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
djdon11
Forum Commoner
Posts: 90
Joined: Wed Jun 20, 2007 5:03 pm

there is a javascript post problem in my page .... help me..

Post by djdon11 »

Hello everyone ..

i have a problem ..

i am using javascript validations on my page .. if there is any error on submitting the form fields than this validation shows a warning box which shows the warning with ok button .. the problem is that .. when i press the ok button the page get submitted :( and all the false values inserted into the database ...

anybody have any idea what it is going on .... ?/?

Code: Select all

function validation()
{
var error ="\n";
var flag=false;
  	if(document.from1.title.value=="")
	  {
		flag=true;
		error=error +"Please You Must Enter The Subject.\n";
    	}
		if(document.from1.person.value=="")
	  {
		flag=true;
		error=error +"Please Enter The responses.\n";
    	}
		if(document.from1.fees.value=="")
	  {
		flag=true;
		error=error +"Please Enter The Fees.\n";
    	}
		if(flag==true)
		
		{
		alert(error)
		return false;
	   }
	   else
	    {
 		return true;
	}
 }
the above is the code for all validations when this get false then the message shows there but when i press ok the form get submitted which should not submit .....
Post Reply