Hello friends,
i've a "editAccount.jsp" page wherein i accept various details from users. And then check their input (Eg. Email field should not be blank)through a function in javascript.
But my JSP does not check the input and directly stores the values in database(even if email field is empty)
I can't figure out where actually the problem lies.
I tried all the possible options, but in vain.
The javascript works fine on other pages - like login, but not on such pages as creating account(newUsers.jsp) or editing account(editAccount.jsp).
i've also tried calling the javascript function on "onclick" event of submit image, but it still doesn't work.

Can the problem be because of Datepicker's code shown in following snippet?

Pls. help ASAP.
I've to install my final software in college tomorow.
Thank you.

My code for "editAccount.jsp" is as follows:

<html>
<head>
<title>My Account</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">

<script language="javascript" type="text/javascript" src="datetimepicker.js">

//Date Time Picker script- by TengYong Ng of [url]http://www.rainforestnet.com[/url]
//Script featured on JavaScript Kit ([url]http://www.javascriptkit.com[/url])
//For this script, visit [url]http://www.javascriptkit.com[/url] 

</script>
<Script language="javascript">
<!--

function Trim(str)
{
return str.replace(/^\s*(.*\S+)?\s*$/, "$1");
}

function frmValidate(Obj)
{
var txtEmail,txtAns,txtAdd,txtCity,txtState,txtZip,country,txtPhone,re_mail,illegalChars;
		
txtEmail = Trim(Obj.txtEmail.value);
txtAns = Trim(Obj.txtAns.value);
txtAdd = Trim(Obj.txtAdd.value);
txtCity = Trim(Obj.txtCity.value);
txtState = Trim(Obj.txtState.value);
txtZip = Trim(Obj.txtZip.value);
country = Trim(Obj.country.value);
txtPhone = Trim(Obj.txtPhone.value);
re_mail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+ 
       ([a-zA-Z])+$/; 
illegalChars = /[\W_]/; 
	

if ( txtEmail == "" )
{
alert("Please enter your Email ID");
Obj.txtEmail.focus();
Obj.txtEmail.select();
return false;
}

if (!re_mail.test(txtEmail))
{
alert("Please enter a correct Email address");
Obj.txtEmail.focus();
Obj.txtEmail.select();
return false;
}

if( txtAns == "" )
{
alert("Please enter your answer");
Obj.txtAns.focus();
Obj.txtAns.select();
return false;
}

if (illegalChars.test(txtAdd)) 
{
alert("Your address contains illegal characters");
Obj.txtAdd.focus();
Obj.txtAdd.select();
return false;
}

if (parseInt(txtCity) == txtCity) 
{
alert("Please enter only alphabets");
Obj.txtCity.focus();
Obj.txtCity.select();
return false;
}

if (illegalChars.test(txtCity)) 
{
alert("Your city contains illegal characters");
Obj.txtCity.focus();
Obj.txtCity.select();
return false;
}

if (parseInt(txtState) == txtState) 
{
alert("Please enter only alphabets");
Obj.txtState.focus();
Obj.txtState.select();
return false;
}

if (illegalChars.test(txtState)) 
{
alert("Your state contains illegal characters");
Obj.txtState.focus();
Obj.txtState.select();
return false;
}

if (parseInt(txtZip) != txtZip) 
{
alert("Please enter only numbers");
Obj.txtPhone.focus();
Obj.txtPhone.select();
return false;
}

if (parseInt(txtPhone) != txtPhone) 
{
alert("Please enter only numbers");
Obj.txtPhone.focus();
Obj.txtPhone.select();
return false;
}

if((txtPhone.length < 10)||(txtPhone.length > 12))
{
alert(" Please enter valid phone number");
Obj.txtPass1.focus();
Obj.txtPass1.select();
return false;
}
}
// -->
</script>   
  
<body onLoad="focus();EditAccount.txtEmail.focus()">
<form name="EditAccount" method=post action="EditMembersAccount.jsp" >

Email ID<input type=text name="txtEmail" size=20 value="<%=mail%>"/></p>  
//mail is initially stored value
.....//all fields

Date Of Birth<input id="demo1" name="dob" type="text" value="<%=dob%>" size="25">
                <a href="javascript:NewCal('demo1','ddmmyyyy')">
                <img src="images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
//above is code to display datepicker
..
...
//remaining fields
<input type="image" src="images/submit1.png">

not urgent. Come back next year.
Gives you time to learn about code tags, html, Javascript, Java, JSP, etc. etc.

I've solved it. There was n problem, just required to write entire script once again.

This question has already been answered. Start a new discussion instead.