CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Trying to modify search criteria using search button

Print topic Send  topic

Author Message
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
View profile  Send private message
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
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.