Jump to content
  • 0

Input Time


Role21

Question

Hi,

I'm trying to create a Time Sheet Web Form. I want my users to enter their start time and end time. However, I don't see a time picker option, I only see a date picker. I don't want my users to enter an invalid time value.

How will I achieve this?

Link to comment
Share on other sites

17 answers to this question

Recommended Posts

  • 0

HI @Role21,

The DateDiff formula will not work on Formula fields, because formula fields do not accept SQL subqueries. If you want to download the records as an excel file, you can do that via report DataPage.  You just need to enable the download options as Excel. It will also include the values from calculated fields.

You may check this sample Report.

 

-JolliBeng

Link to comment
Share on other sites

  • 0
On 6/22/2019 at 10:54 PM, JolliBeng said:

HI @Role21,

The DateDiff formula will not work on Formula fields, because formula fields do not accept SQL subqueries. If you want to download the records as an excel file, you can do that via report DataPage.  You just need to enable the download options as Excel. It will also include the values from calculated fields.

You may check this sample Report.

 

-JolliBeng

Hi there, I think Datediff formulas does work on formula fields, except if you are using GetDate().

Datediff will work if the dates are deterministic (static). So if you're just computing for how many minutes were spent between start time and end time, DateDiff(minutes, starttime, endtime) should work in the Formula datatype. 

:)

Link to comment
Share on other sites

  • 0

Hi - I just wanted to share this workaround for saving time data. You can use this external script: https://flatpickr.js.org/examples/

To apply this in the DataPage, insert this code in the Header:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">

<style>

.flatpickr-calendar {

 font-family: system-ui !important;

}

</style>

Footer:

<!-- jQuery -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
 <!--  Flatpickr  -->
  <script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>

<script>

$("#InsertRecordTime").flatpickr({
    enableTime: true,
    noCalendar: true,
    dateFormat: "h:i K"
});
</script>

InsertRecordTime - this should be changed with your right FIELDNAME. Take note that the Data Type of the field is Text(255) and disable the Calendar Popup.

image.png

Result:

image.png

To know more about the time, see this link: https://flatpickr.js.org/examples/#time-picker

Link to comment
Share on other sites

  • 0
On 5/30/2023 at 2:30 PM, Meekeee said:

Hi - I just wanted to share this workaround for saving time data. You can use this external script: https://flatpickr.js.org/examples/

To apply this in the DataPage, insert this code in the Header:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">

<style>

.flatpickr-calendar {

 font-family: system-ui !important;

}

</style>

Footer:

<!-- jQuery -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
 <!--  Flatpickr  -->
  <script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>

<script>

$("#InsertRecordTime").flatpickr({
    enableTime: true,
    noCalendar: true,
    dateFormat: "h:i K"
});
</script>

InsertRecordTime - this should be changed with your right FIELDNAME. Take note that the Data Type of the field is Text(255) and disable the Calendar Popup.

image.png

Result:

image.png

To know more about the time, see this link: https://flatpickr.js.org/examples/#time-picker

Hi MeeKee,

This works but only on page load. The user has to refresh the webpage in order for the picker to work again. I have a form and a table with results both displayed on my web page. How do I get the javascript to  automatically refresh itself and allow submissions after the initial time submission form is sent?

Thanks!

Link to comment
Share on other sites

  • 0

Hello @TheAdventure,

Please test the code that utilizes the DataPageReady event.

So, in the Header add the styles and CDNs:
 

<style>
.flatpickr-calendar {
    font-family: system-ui !important;
}
</style>

 <!--  Flatpickr  -->
<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">

In the Footer:

<script>
document.addEventListener('DataPageReady', customCalendarHandler);

function customCalendarHandler(){

const timeField = document.querySelector(('input[id*="InsertRecordTime"]')); //Time is the field name that should be replaced if needed
timeField.flatpickr({
    enableTime: true,
    noCalendar: true,
    dateFormat: "h:i K"
});

}
</script>

Hope this fixes the issue. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...