Hi:
This following is my html code:
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
function isLeapYear (Year) {
if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0)) {
return (true);}
else { return (false) }
}
function checkDate(){
var mNames = 'JanFebMarAprMayJunJulAugSepOctNovDec'
var mValues = '312831303130313130313031'
var alertMsg = ''
wrongDate =new Boolean
wrongDate = false
myValue = document.leadsReport.leadDate.value
if (myValue.length<10)
{
wrongDate = true
}
if ( (myValue.substring(2,3) != '/' ) || (myValue.substring(5,6) !=
'/') ) {
wrongDate = true
}
myMM = parseInt(myValue.substring(0,2),10)
myDD = parseInt(myValue.substring(3,5),10)
myYYYY = parseInt(myValue.substring(6,10),10)
if (myYYYY < 1000){
wrongDate = true
}
if ( (isNaN(myDD)) || (isNaN(myMM)) || ( isNaN(myYYYY)) ){
wrongDate = true
}
if ( (myMM > 12) || (myMM <= 0) ){
wrongDate = true
}
var lastDate = 0
if (myMM == 2){
if (isLeapYear(myYYYY)) {
lastDate = 29
}
else{
lastDate = 28
}
}
else {
lastDate = mValues.substring((myMM-1)*2, (myMM-1)*2+2)
}
if ( (myDD > lastDate) || (myDD <=0) ){
wrongDate = true
}
if(wrongDate == true)
{
alert('Please enter in full date format dd/mm/yyyy at Leads Added
Since');
}
else
{document.leadsReport.submit();}
}
</SCRIPT>
<BODY>
<FORM NAME='leadsReport' ACTION= "/geccd/servlet/fsleads.reportDist"
METHOD =POST>
<P></P>
<TABLE WIDTH='600' BORDER='0'>
<TR>
<TD><INPUT TYPE='SUBMIT' NAME='button' VALUE='Contact Info'></TD>
<TD><INPUT TYPE='SUBMIT' NAME='button' VALUE='Initial'></TD>
<TD><INPUT TYPE='SUBMIT' NAME='button' VALUE='PipeLine'></TD>
<TD><INPUT TYPE='SUBMIT' NAME='button' VALUE='Work in
Progress'></TD>
<TD><INPUT TYPE='SUBMIT' NAME='button' VALUE='Final'></TD>
<TD><INPUT TYPE='SUBMIT' NAME='button' VALUE='Assign Lead'></TD>
<TD><A HREF = "/geccd/servlet/fsleads.Logout">Logout</A></TD>
</TR>
</TABLE>
<TABLE WIDTH='600' BORDER='0'>
<TR>
<TD WIDTH='250'>
<P><SELECT NAME='selectRecord' SIZE='1'>
<OPTION VALUE='All' SELECTED='SELECTED'>All Records</OPTION>
<OPTION VALUE='Unsigned'>Unsigned</OPTION>
<OPTION VALUE='noinit'>No Initial Disposition</OPTION>
<OPTION VALUE='proposal'>In Progress - Proposal</OPTION>
<OPTION VALUE='secondappt'>In Progress - Second
Appointment</OPTION>
<OPTION VALUE='pending'>Pending W/Decision Probability</OPTION>
<OPTION VALUE='sold'>Final Disposition - Sold</OPTION>
<OPTION VALUE='lost'>Final Dispostion -
Lost</OPTION></SELECT></P></TD>
<TD WIDTH='350'>Leads added since: <INPUT TYPE='TEXT'
NAME='leadDate' SIZE='10' MAXLENGTH='10' value = '01/01/1999'></TD>
</TR>
<TR>
<TD WIDTH='250'>
<P><INPUT TYPE='button' NAME='buttonSubmit' onClick='checkDate();'
VALUE='Submit Query'></P></TD>
<TD WIDTH='350'></TD>
</TR>
</TABLE>
<P>
</P>
</FORM>
<P></P>
</BODY>
</HTML>
Because buttonSubmit will check text box date format using javaScript, If I
set this button type as submit, even checkDate() find wrong date format, it
still go to servlet reportDist page.
Then I tested another way. I define the buttonSubmit as <input type="submit"
name="button" onClick="checkDate(); return false;" value="Submit Query"> in
javascript checkDate(), after process this function. if everything is OK, I
set document.leadsReport.submit(); to get servlet page.
When I click this button, I can not pass the value="Submit Query" to servlet
page. If I take off document.leadsReport.submit(); in javascript, then I
click the third button, nothing happens.
Thanks.
DJ
> ----------
> From: Giscard Girard[SMTP:[EMAIL PROTECTED]]
> Reply To: A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology.
> Sent: Thursday, September 30, 1999 13:27
> To: [EMAIL PROTECTED]
> Subject: Re: button problem in Netscape
>
> Give us more information on what you've got on the client side to set the
> value of submitButton field, this is likely where your problem is.
>
> Giscard
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
>
> __________________________________________________________________________
> _
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html