Alpha Video Training
Results 1 to 8 of 8

Thread: Default Date in Search Field

  1. #1
    "Certified" Alphaholic Rich Hartnett's Avatar
    Real Name
    Richard Hartnett
    Join Date
    Nov 2002
    Location
    Bowie, MD
    Posts
    1,456

    Default Default Date in Search Field

    I have a simple grid with a Search section. There are only three options in the search section. (Date, ID No., and Location.)

    I would like the Date field to default to the current system date, with the user having the ability to change it if need be.

    Is this possible?

  2. #2
    Member
    Real Name
    Jeff Benson
    Join Date
    Jul 2002
    Location
    Stamford, CT USA
    Posts
    90

    Default Re: Default Date in Search Field

    If you set the search field date to a calendar control type, then the displayed calendar will default to the system date and the user can still change it.

    Alternatively, you can set the control type to TextBox and enable the date picker. The date displayed is the system date.
    Last edited by Jeff Benson; 07-04-2006 at 10:59 PM.

  3. #3
    Member
    Real Name
    Jeff Benson
    Join Date
    Jul 2002
    Location
    Stamford, CT USA
    Posts
    90

    Default Re: Default Date in Search Field

    Here's a 3rd method:

    Assuming your component is named "testme_acd" and the date field you want to include in the search is named "DATE".

    Set the DATE Control type to TEXTBOX.
    Unselect DATE PICKER.
    Enable Free Form Layout for the DATE field.
    Enter the line below for the Freeform Template:

    <input id="testme_acd_S_date" name="testme_acd_S_date" value="<%a5 ?date() %>">
    Last edited by Jeff Benson; 07-04-2006 at 11:46 PM.

  4. #4
    "Certified" Alphaholic Rich Hartnett's Avatar
    Real Name
    Richard Hartnett
    Join Date
    Nov 2002
    Location
    Bowie, MD
    Posts
    1,456

    Default Re: Default Date in Search Field

    Quote Originally Posted by Jeff Benson
    If you set the search field date to a calendar control type, then the displayed calendar will default to the system date and the user can still change it.

    Alternatively, you can set the control type to TextBox and enable the date picker. The date displayed is the system date.

    Hi Jeff,

    I already use your second option (TextBox with Date Picker) but it does not place the current date in the text box. The date is not filled until the user clicks on "Today" or another date. Likewise, setting the control to "Calendar" really does the same thing. Again, no auto-fill untill the user chooses the date manually.

    I want it so that once the page is brought up, the user can simply hit the "Submit" button, and the form will search the current date.

    I haven't tried option #3 yet, as in this particular case I do not want to use freeform layout.

    I wonder if some kind of expression in the text box would cause the current data to be automatically inserted?

  5. #5
    Member
    Real Name
    Jeff Benson
    Join Date
    Jul 2002
    Location
    Stamford, CT USA
    Posts
    90

    Default Re: Default Date in Search Field

    When I set the control type to calendar, the calendar displays in-line right after the label and the date is set to today and the user doesn't have to select anything except other search criteria (if any).



    If you set the control type to calendar and select free-form layout AND use the code from option 3 I gave you earlier, you'll get this result: (I don't think it matters if control type is calendar or textbox, but this 3rd method is the only way I know to get the value in there).


  6. #6
    Member
    Real Name
    Daniel Weiss
    Join Date
    May 2000
    Location
    Monsey, NY
    Posts
    506

    Default Re: Solution to start with a default date

    Here is a solution to start with a default date and using the date picker
    Change the field to a freeform template and enter this code
    Note; “V.R1.SPCSERV_DATE” is the field name in this example


    Code:
    <input id="V.R1.SPCSERV_DATE"  size="10" maxlength="10"  class="WinXP2Input" type="text" name="V.R1.SPCSERV_DATE" value="<%a5 ?date() %>" /><a onclick="load_date_picker('V.R1.SPCSERV_DATE',document.getElementById('V.R1.SPCSERV_DATE').value, NewRequ_SPCSERV_DATE_DateSet)"><img src="css/CalendarIcons/Calendar2.png" border="0" /></a>
    Last edited by Daniel Weiss; 07-13-2006 at 11:18 AM.
    Daniel Weiss
    EZ Link Software

  7. #7
    "Certified" Alphaholic Rich Hartnett's Avatar
    Real Name
    Richard Hartnett
    Join Date
    Nov 2002
    Location
    Bowie, MD
    Posts
    1,456

    Default Re: Default Date in Search Field

    Dan where do I put the code?

  8. #8
    Member
    Real Name
    Daniel Weiss
    Join Date
    May 2000
    Location
    Monsey, NY
    Posts
    506

    Default Re: Default Date in Search Field

    Set the control type to “Textbox”
    Check the “Date Picker”
    Save it and view the HTML of the grid
    Find the date control and copy this section to your clipboard , start from “<input id=” to “</a>, (see code below)

    Code:
    <input id="V.R1.SERV_DATE"  size="10" maxlength="10"  class="WinXP2Input" type="text" name="V.R1.SERV_DATE" value="" /><a onclick="load_date_picker('V.R1.SERV_DATE',document.getElementById('V.R1.SERV_DATE').value, NewRequ2_SERV_DATE_DateSet)"><img src="css/CalendarIcons/Calendar2.png" border="0" /></a>
    Now put a check in the “Freeform layout” checkbox and paste your clipboard to the “Freeform template”
    Change
    Code:
    “value=""
    to
    Code:
    value="<%a5 ?date() %>"
    Save it
    Daniel Weiss
    EZ Link Software

Similar Threads

  1. Search on Date?
    By Peter.Greulich in forum Web Application Server v7
    Replies: 4
    Last Post: 01-03-2006, 02:31 PM
  2. Default Date in Search Bar
    By Rich Hartnett in forum Web Application Server v6
    Replies: 0
    Last Post: 07-07-2005, 12:54 PM
  3. Default a date field to NULL or EMPTY...
    By Hansolo in forum Alpha Five Version 6
    Replies: 44
    Last Post: 02-07-2005, 01:03 PM
  4. Current date required in table field default form
    By David Morgan in forum Alpha Five Version 6
    Replies: 2
    Last Post: 01-23-2005, 12:43 PM
  5. Default Change Date Field
    By Nip Lewis in forum Alpha Five Version 4
    Replies: 11
    Last Post: 08-14-2000, 07:29 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
  •