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 -> General/Other

 Date Listbox

Print topic Send  topic

Author Message
Sue
Posted: 02/13/2004, 11:15 AM

Hi,

I need a field in my form where a user can select the date from a period of 7 days fom the current date:

Example: today is the 13th - My list box needs to contain the dates from Saturday the 14th to saturday the 21st (minus Sundays). It has to dynamically change every day. I can do it in PHP but haven't figured out how to get that code into my project form.

Thanks,
Sue
kevin
Posted: 03/03/2004, 12:45 PM

2 thoughts

1. if you can generate the dates as a string and load them into the control with the semi-colons separating them, that would work - I've not tried changing this particular part of a control yet - do in the before show event section of the page

2. first user in for the day causes a short script to run and fill a database table with the required dates, then make the data source the table of values instead of a list - only hang up might be users in different time zones.



Rick

Posts: 52
Posted: 03/03/2004, 5:27 PM

I posted an earlier reply that addresses this issue and uses ASP code.
See: http://forums.codecharge.com/posts.php?post_id=24793 .

Perhaps you are hung up on what at first confused me so you may want to focus on the following text of that post:
"Note: Data source type for listbox field must be 'List of Values'. I also found out (the hard way) you must specify a starting Data Source value pair to start out with even though it will be replaced by the Record Before Show Code. If you do not have a starting value you get an error message when you generate page - I at first abandoned my attempt to do it this way until I thought hours later that a starting pair value may be required."

Follow above idea but use PHP code similar to below which I placed in the record before show event.

- record name is player
- listbox name is textdateshort


$player->textdateshort->Values = array(array(date ("m-d-y",mktime (0,0,0,date("m"), date("d")+1, date("Y"))), date ("m-d-y",mktime (0,0,0,date("m"), date("d")+1, date("Y")))), array(date ("m-d-y",mktime (0,0,0,date("m"), date("d")+2, date("Y"))), date ("m-d-y",mktime (0,0,0,date("m"), date("d")+2, date("Y")))), array(date ("m-d-y",mktime (0,0,0,date("m"), date("d")+3, date("Y"))), date ("m-d-y",mktime (0,0,0,date("m"), date("d")+3, date("Y")))));

Listbox with this code displays choices 03/04/04, 03/05/04, 03/06/04 if todays date is 03/03/04. Of course your code extends this for a few more days.

Hope this helps.

Rick
View profile  Send private message
DonB
Posted: 03/03/2004, 7:12 PM

Create a table - one column, a number field called "Daynum". Load it with
0-n (6 will suffice for your needs).

Do a SELECT DateAdd('d',[Daynum],Now()) from that table. You get 7 rows,
containing dates from today through the 7th day. You can put more values
in your table and select WHERE Daynum < 7 or some other value if/when you
need more than 1 weeks' worth. You can also experiment with [Daynum]-n in
the SELECT to start the list before the current day.

You might make the table 12 values and it would let you go a year in steps
of 1 month if needed. Change the 'd' to 'm'.

The above assumes Access and ASP, but the same concept works with PHP or
mySQL, etc.

--
DonB

http://www.gotodon.com/ccbth


"Sue" <Sue@forum.codecharge> wrote in message
news:2402d226daee00@news.codecharge.com...
> Hi,
>
> I need a field in my form where a user can select the date from a period
of 7 days fom the current date:
>
> Example: today is the 13th - My list box needs to contain the dates from
Saturday the 14th to saturday the 21st (minus Sundays). It has to
dynamically change every day. I can do it in PHP but haven't figured out how
to get that code into my project form.
>
> Thanks,
> Sue
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


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.

MS Access to Web

Convert MS Access to Web.
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.