sugoi_kat Posted April 30, 2006 Share Posted April 30, 2006 The user can view a report during a specific period by specifying the starting and ending date. What I want to do is check that the ending date of the period they specify isn't less than the start date. The code below is the current function i'm using to check that the period is valid. It takes values from the textbox on the page and compares the two dates and if the starting period is greater than the ending period, then an alert message appears. However, it doesn't seem to work. Am I doing this correctly? function checkDate(){ var dStart = document.stu_comp_ex_report.startDt.value; var dEnd = document.stu_comp_ex_report.endDt.value; if (dStart > dEnd) { window.alert("Make sure the start period is before the ending period"); } else } if (dStart = null || dEnd = null) { window.alert("Please ensure that the starting period and the ending period are stated"); } }} Link to comment Share on other sites More sharing options...
Little Goat Posted April 30, 2006 Share Posted April 30, 2006 after else you have a } it needs to be a {LG Link to comment Share on other sites More sharing options...
sugoi_kat Posted May 2, 2006 Author Share Posted May 2, 2006 hi i corrected the brackets,but it's still not checking the the date any ideas? by the way i forgot to mention that this code should have executed when a button is pressed to recalculate data in the report Link to comment Share on other sites More sharing options...
Little Goat Posted May 2, 2006 Share Posted May 2, 2006 hi i corrected the brackets,but it's still not checking the the date any ideas? by the way i forgot to mention that this code should have executed when a button is pressed to recalculate data in the report<{POST_SNAPBACK}> how do you have the button set up?LG Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now