9 Replies Latest reply on Oct 15, 2010 5:48 PM by Günter Schenk

    time to call back in form

    Level 1

      hi,

       

      i know there is a datepicker option built into addt however is there a built any or easy way to add a time to call back on the form?

       

      i am using in mysql database column type TIME.

       

      many thanks

        • 1. Re: time to call back in form
          Günter Schenk Level 4

          As mentioned in the ADDT help file (Retrieve Dynamic Data -> Developer Toolbox Dynamic Data -> Use Developer Toolbox mark-up language) you could indeed use the ADDT mark-up {now_t} to automatically insert the current time.

           

          Cheers,

          Günter

          • 2. Re: time to call back in form
            Level 1

            hi gunter,

             

            i was more looking for the user to choose the time of the call back rather than a timestamp.

             

            i was thinking of using a mask field so that the user would have to key in 15:30:00 what do you think? is the best way to enforce the correct time insertion?

             

            many thanks

            • 3. Re: time to call back in form
              Günter Schenk Level 4

              Ah now I understand what you´re talking about ;-)

               

              In this case I personally wouldn´t use a MySQL "time" column type at all because of the given hh:mm:ss - format, which is (due to the required 2 colons) hard to handle for regular human beings. In addition to that: do you really expect the visitor to even enter the seconds which you most assumingly don´t even need in this context ? ;-)

               

              I´d do it in a different and certainly less error-prone way:

               

              1. establish an "int(2)" column for the hours and have the form show a corresponding 2-chars text field

              2. do the same for the minutes.

              Advantages of all this are: no seconds needed any longer, and you won´t have to establish a regex-based form validation rule which checks for the required two colons, as the the only thing you´d have to check for is the built-in "integer" criterion.

               

              i was thinking of using a mask field...

              ...which could also be applied to a regular text field that´s supposed to contain an hh:mm - value, but in this case the corresponding MySQL column would have to be varchar(5) due to the single colon. It´s of yourse your choice, but as ADDT´s "masked field" form controls is a javascript-based widget, it will of course fail when the visitor´s brwoser has javascript disabled.

               

              Cheers,

              Günter

              • 4. Re: time to call back in form
                Level 1

                thanks gunter, the only problem i was thinking of not using a time column is then setting reminders.

                 

                i was going to flag up by doing a query that would check if the time of the call back was in 15 minutes time.

                 

                not sure how i would do that with an int columns types?

                 

                thanks again gunter.

                • 5. Re: time to call back in form
                  Günter Schenk Level 4

                  Seems that I have to correct myself about my previous remarks on the "time" columns: according to the MySQL Reference manual you "can specify TIME values in a variety of formats:

                   

                  As a string in 'D HH:MM:SS.fraction' format. You can also use one of the following “relaxed” syntaxes: 'HH:MM:SS.fraction', 'HH:MM:SS', 'HH:MM', 'D HH:MM:SS', 'D HH:MM', 'D HH', or 'SS'"yadda".

                   

                  That said: leaving out the seconds (:ss) part should work.

                   

                  Cheers,

                  Günter

                  • 6. Re: time to call back in form
                    Level 1

                    thanks gunter for all your help, really appreciate it.

                     

                    so you reckon my masking way should work then as my column type is TIME.

                     

                    i have set the mask to 99:99 so it auto adds the slashes in to the fiels and also added time validation to the field.

                     

                    i know that if they have java script disabled then this could cause issues, however it is for a in house company and we always recommend default browser settings. most browsers do not disable by default and most users dont know how to actually do this anyway i reckon.

                     

                    thanks again gunter

                    • 7. Re: time to call back in form
                      Günter Schenk Level 4

                      so you reckon my masking way should work then as my column type is TIME.

                      just give it a try and check if this value has been correctly saved to that TIME column

                       

                      most browsers do not disable by default and most users dont know how to actually do this anyway i reckon.

                      I wouldn´t be that sure about this -- one never knows. Many folks using Firefox already know what the popular "no script" addon does, and it´s easy to install for everyone.

                       

                      i know that if they have java script disabled then this could cause issues

                      That´s why it would be wise to - additionally - use the following regular expression pattern for ADDT´s form validation, which will make sure that the input field contains the required hh:mm - data, and that both the "hh" and the "mm" segments contain digits only:

                       

                      ^\d{2}:\d{2}$

                       

                      Cheers,

                      Günter

                      1 person found this helpful
                      • 8. Re: time to call back in form
                        Level 1

                        hi gunter,

                         

                        sorry to bother you again.

                         

                        this was working fine with the mask field and making it so it add : when adding the time in the form.

                         

                        only problem now is that i actually need to make the column a datetime column to correspond with my calendar view now.

                         

                        is it possible to have 2 input fields in my insert record form but it insert into the one datetime column? so the type in the date in one field then type the time in the masked field and it uses both values to insert into the datetime column rather than the seperate columns i had setup originally?

                         

                        hope to hear from you soon.

                         

                        many thanks

                        • 9. Re: time to call back in form
                          Günter Schenk Level 4

                          Hi deansy,

                           

                          deansy55 wrote:

                           

                          is it possible to have 2 input fields in my insert record form but it insert into the one datetime column?

                          ADDT comes with two pretty cool "helpers" which need to be placed inside a Custom Trigger:

                           

                          1. $tNG->getColumnValue("column_name") = will retrieve an Insert/Update transaction value, usually equal to the form field name

                           

                          2. tNG->setColumnValue("column_name", value); = will set the value of a specified column

                           

                          Technically it should work by pasting the following code (which, in line 3, actually combines two previously declared variables and inserts a ' ' space in between) in a Custom AFTER Trigger and of course adapting the sample column names:

                           

                          $date_value = $tNG->getColumnValue("date_column");

                          $time_value = $tNG->getColumnValue("time_column");

                          $datetime_value = $date_column.' '.$time_column;

                          tNG->setColumnValue("datetime_column", $datetime_value);

                           

                          Hope this helps,

                          Günter