473,503 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

From Date/To Date Issue

Stang02GT
1,208 Recognized Expert Top Contributor
Here is the issue that I am having. I have two text feilds where users need to enter a "From Date:" and a "To Date:" they then hit a update button and my code will pull back the data for the date ranges they have selected.

If the user enters the same date in both from and to fields they are expecting to see just one row returned for that day, BUT what is really happening is it is returning all the data.

Does anyone have any suggestions or ideas on how I can just have one row return if the users enter the same date?


Expand|Select|Wrap|Line Numbers
  1. <SCRIPT language="javascript">
  2.  
  3. function submit() {
  4.  
  5.     var fundshareid = document.getElementById('fundshareid').value;
  6.     var fd = document.getElementById('fd').value;
  7.     var td = document.getElementById('td').value;
  8.  
  9.     var tp = "<%=request.getParameter("tp")%>";
  10.  
  11.     if (tp == null || tp == "null") {tp = "fl";}
  12.  
  13.     return document.location = "<%=request.getAttribute("baseURI")%>" + "?fd=" + fd + "&fundshareid=" + fundshareid + "&link=products&td=" + td + "&tp=" + tp + "&ut=" + "<%=request.getParameter("ut")%>";
  14.  
  15. }
  16.  
  17. function validate(){
  18.  
  19.     if (isDate(document.forms[1].fd.value)==false){
  20.         document.forms[1].fd.focus();
  21.         return false;
  22.     }
  23.     if (isDate(document.forms[1].td.value)==false){
  24.         document.forms[1].td.focus();
  25.         return false;
  26.     } else {
  27.         fd = new Date(document.forms[1].fd.value);
  28.         td = new Date(document.forms[1].td.value);
  29.         if (fd > td){
  30.             alert("We're sorry, but we are unable to display the requested data.  Please select a \"To Date\" that is greater (more recent) than the \"From Date.\"");
  31.             return false;
  32.         }
  33.     }
  34.  
  35. return true;
  36. }
Aug 7 '08 #1
1 1538
acoder
16,027 Recognized Expert Moderator MVP
You don't need a submit() function to do this job for you when you can just let the browser pass the values in the correct format. If you use this format:
Expand|Select|Wrap|Line Numbers
  1. <form ... onsubmit="return validate()">
then the form will submit if validate() returns true. If you need extra values, add some hidden values.
Aug 7 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2748
by: |-|erc | last post by:
Hi! Small challenge for you. The index.php uses this file and calls layout(). Take a look at www.chatty.net this file draws the chat login box on the right. I traced the CHAT button it submits...
2
2470
by: sandy | last post by:
Hello, I am trying to automate a date. When typing in the issue date I want it to automatically calculate 6 months fronm the issue date and give me the Expiration date. Following is code that I am...
12
12394
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank,...
2
2308
by: Hennie de Nooijer | last post by:
Because of an error in google or underlying site i can reply on my own issue. Therefore i copied the former entered message in this message....
4
6586
by: SQLJunkie | last post by:
Here is an issue that has me stumped for the past few days. I have a table called MerchTran. Among various columns, the relevant columns for this issue are: FileDate datetime , SourceTable...
5
2493
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant...
21
3337
by: Darin | last post by:
I have an applicatoin that works 100% perfect when running on a machine setup for English (United States), but when I change it to Spanish (Mexico), the dates start giving me fits. THe reason is...
11
3648
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
5
2482
by: jjeanj1 | last post by:
I am having issue using a user defined variable i an a mysql statement. here is the issue that i am facing: i have a variable called $date in php.This variable is assigned a valued from a dropdown...
0
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7074
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7273
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7322
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5000
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1501
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
374
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.