posted 17 years ago
Hi,
My problem is if a user enters a date in text box(dd-MMM-YYYY) format then the entered date must be after the current system date else an alert box must be raised.
The code that i have written is
<HTML><head>
<link rel="stylesheet" type="text/css" href="./managchpass.css" />
<script>
function fun()
{
var flag1=0;
var s6=document.f1.T3.value;
var s7=document.f1.date.value;
if(s6=="")
{
window.alert("Enter CloseDate");
flag7=0;
}
else if((s6.after(s7)) || (s6.equals(s7)))
{
flag7=1;
}
else
{
flag7=0;
window.alert("Enter correct date which is after current date");
}
if(flag1)
return true;
else
return false;
}
</script>
</head>
<body text="black" >
<FORM name=f1 method="post" action="./msurveydisp" onsubmit="return fun()">
<CENTER><B><u><FONT size=6 face="monotype corsiva">Create Poll</u></b> <br>
<%@page import="java.lang.*,javax.servlet.*,java.io.*,java.util.*,javax.servlet.http.*,java.sql.*"%>
<%
java.util.Date d=new java.util.Date();
DateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy");
Format f = new SimpleDateFormat("dd-MMM-yyyy");
f.format(d);
%>
<table>
<TR>
<td>
ENTER THE CLOSING DATE OF THE
POLL<INPUT type=text name="T3"></td></tr>
</TABLE>
<input type="hidden" name="date" value="<%=f.format(d)%>">
<input type="image"
src="C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\prath\submit.jpg">
<a href="managesurvey.html">
<img src="C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\prath\back.jpg" border="0"></a>
</FORM></B>
</BODY>
</HTML>
Please help in solving this problem
[ April 05, 2007: Message edited by: prathiba panati ]