Vladimir Astachkine
|
| Posted: 09/20/2005, 7:04 AM |
|
Hi,
I implement simple record form with search window on top as created by wizard. In search box, there are two fields corresponding to date type limiting choice of records with begin_date and final_date limits. What I want to get is to provide users with buttons like "today" and "this week" limiting choice to corresponding date range. I tried three ways of doing so:
1. Modify begin_date search form control value in OnClick event on my "today" button. Problem is that I can't modify begin_date control in search form before search actually starts.
2. I tried to use Java Script "OnClick" event filling begin_date control with a value for current date. For some reason this did not work at all. I used
document.begin_date.value = "01/01/2005"
expression and this just did not work. My knowledge of java script is very limited for the moment.
3. Last thing I tried to do is to modify "where" parameter of the data grid and I could do that. Problem is to let it know when it should modify this parameter since it does not know which search button has been pressed, standard "search" button or today "button".
Please help.
|
|
|
 |
kevind
Posts: 251
|
| Posted: 09/21/2005, 3:09 PM |
|
Hi,
I would make 3 hidden fields in your search form.
hdnToday, hdnStartofWeek and hdnEndofWeek
in the before show event of the form add the action to retrieve values for these fields - since this would occur on the server side you're dealing with VBScript instead where the date manipulation is easier. I won't provide you with the functions - just search the internet for these.
then create some buttons and in the on-click event you can put:
document.SearchForm.SearchStartDate.value=document.SearchForm.hdnToday.value ;
that's it - the field you want to insert a value to will pick it up from a hidden field and you don't have to deal with alot of javascript.
kd
_________________
thanks
Kevin
======================
CCS 3.2.x / ASP / MS Access /mySQL / PHP / jQuery / jQuery UI / jQuery Mobile
|
 |
 |
donb
Posts: 52
|
| Posted: 09/21/2005, 5:04 PM |
|
Create the form so that it passes a parameter value like "T" or "W" back, then you can use Before Build Select code in the datasource of the grid (or other form) to construct the appropriate WHERE terms (in other words, the browser needs only to specify the 'kind' or range, and your server side code does the work of converting that into two endpoints (date) that form the basis of your query.
_________________
http://www.gotodon.com/ccbth |
 |
 |
|