New call-to-action
Results 1 to 5 of 5

Thread: drop down box for date

  1. #1
    Member
    Real Name
    Rune Back
    Join Date
    Jul 2011
    Location
    Jakobstad, Finland
    Posts
    58

    Default drop down box for date

    Hi,

    I'm trying to make an ordinary html drop down box for a date, with SELECT options starting at date() and ending at date()+364. The ordinary date picker is fine, BUT it doesn't work well on all mobile screens. I need this for a mobile web page.
    How on (Alpha) earth am I going to do it?

    Thankful for any help,

    Runback

  2. #2
    Member
    Real Name
    Nick
    Join Date
    May 2011
    Location
    Michigan, USA
    Posts
    58

    Default Re: drop down box for date

    I'm just making this up and it may not be the best way to go but maybe something like this:

    This assumes you're working with a grid.
    Set the dropdown to use a variable, say DateList.
    In the OnGridInitialize for the grid set e.rtc.DateList to be a CRLF-delimited list containing the dates you want.

    I quickly tested out some xBasic to make the list:
    Code:
    i = 0
    DateList = ""
    while (i < 365)
          DateList = DateList + (date() + i) + CRLF(1)
           i = i + 1
    end while
    This gave me a list of dates (formatted as "mm/dd/yyyy") from 08/18/2011 to 08/16/2012 (2012 is a leap year so we don't get to 08/17/2012).

  3. #3
    Member
    Real Name
    Rune Back
    Join Date
    Jul 2011
    Location
    Jakobstad, Finland
    Posts
    58

    Default Re: drop down box for date

    The script works like a dream! Thank you! (My list comes out dd-mm-yyyy, the way it should in this part of the world. The leap year doesn't matter.) - The first/initial/default value is blank. How do I delete the blank option making date() the first/initial/default value?

  4. #4
    Member
    Real Name
    Nick
    Join Date
    May 2011
    Location
    Michigan, USA
    Posts
    58

    Default Re: drop down box for date

    There may be another way, but I think an easy way would be to go to the grid and set the initial value property of the field as =date().

  5. #5
    Member
    Real Name
    Rune Back
    Join Date
    Jul 2011
    Location
    Jakobstad, Finland
    Posts
    58

    Default Re: drop down box for date

    I can't make it work with the initial value property, but it does work setting e.newValues.StartDate = Date() in OnInitialValueCalculate and changing your loop to start tomorrow, i.e. 'i' runs from '1' to '< 364'.
    Last edited by Runback; 08-19-2011 at 03:22 AM.

Similar Threads

  1. Drop Down Box with todays date + 5 days out
    By Tim Morelli in forum Alpha Five Version 4
    Replies: 7
    Last Post: 08-18-2011, 08:23 AM
  2. ? about drop-down box
    By cbauer50 in forum Alpha Five Version 9 - Desktop Applications
    Replies: 3
    Last Post: 08-19-2009, 12:27 PM
  3. Scenario with DROP DOWN BOX
    By ravish in forum Application Server Version 8
    Replies: 1
    Last Post: 01-17-2008, 05:09 AM
  4. 2 Drop Down Box
    By jacklcs22 in forum Application Server Version 8
    Replies: 0
    Last Post: 07-17-2007, 04:07 AM
  5. drop down box
    By tony cox in forum Alpha Five Version 5
    Replies: 4
    Last Post: 10-02-2003, 08:09 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •