3 Replies Latest reply on May 14, 2008 1:39 AM by (Design_Stage)

    How do I add a time field to a dynamic list and form?

      I'm trying to create an update form that logs when an action was taken. Among the fields are one for the date and one for the time, but I've not been able to get the time field to display or enter data correctly.

      I've set the time format in the ADDT preferences (database date and time format is yyyy-mm-dd and HH:mm:ss and screen format is dd/mm/yyyy and HH:mm). When I create the list or the form using the wizard, there is no option to display the field as a time.

      In step 3 of 4 in the Dynamic List Wizard, the 'Display as' options are: text, numeric, double and date. Choosing date for the time field gives me a display as though it was a date (I get '00/00/0000'). I have the same problem with generating a Dynamic Form in that there is no option to display a time, only a date.

      Am I able to do this using the wizard, or is there another way that I'm, missing? Thanks for any help.
        • 1. Re: How do I add a time field to a dynamic list and form?
          Günter Schenk Level 4
          Hi,

          if you want to log the date and the time "behind the scenes", you could create a MySQL datetime column, which has the format YYYY-MM-DD HH:MM:SS, and use ADDT´s markup {NOW_DT} (aka current datetime) as default value.

          Another option would be to establish a MySQL timestamp column -- its advantage is: the current datetime will be stored automatically, means you won´t have to integrate this column into ADDT´s Update Record transaction at all.

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: How do I add a time field to a dynamic list and form?
            georgev63 Level 1
            If those date/time fields are only needed for logging purposes then follow Günter's instructions.
            If you need to be able to edit those two fields and have their values displayed properly then there are several steps you should take.
            First open the page that uses the Dynamic List behavior and make sure that all date and time fields are configured to display as dates. Then open the page with the dynamic form and click on "Manage Dynamic Form Wizard" in the Developer Toolbox. Configure your date and time fields to submit as dates. Then go to the Server Behaviors panel and double click on "Validate Form". You should now have 3 date/time options available under Validation Format: Date, Datetime, and Time. Configure each field as needed.
            This will ensure that date and time fields are saved in the proper format so that when you view their values they will be displayed properly, that is dates will be displayed as dates and times as times.
            There are also several additional server formats available that are accessible through the Bindings panel that you might want to experiment with.
            • 3. Re: How do I add a time field to a dynamic list and form?
              Level 1
              Thanks to both for your help. My error was in setting up both the date field and the time field as 'DATETIME' datatypes in my MySQL database instead of 'DATE' and 'TIME', so even when I followed George's workflow (which was almost exactly like mine, except I applied the validation when I set up the dynamic form), the value '0000-00-00 00:00:00' was stored.

              I've added in a timestamp as well - I created this so that I can keep a record of work I do for my clients, and it doesn't hurt to see the last time the record was altered anyway.