aam82 Posted March 17, 2015 Report Share Posted March 17, 2015 Hi, I can't figure out how to allow someone to enter time in a Submission form. If I set the field to Date/Time, then I must enter a valid date, but I want to enter time only. I am also hoping there is a smart feature that can interpret/parse "8pm" and "815." thanks Quote Link to comment Share on other sites More sharing options...
Jan Posted March 17, 2015 Report Share Posted March 17, 2015 Hello aam82, There is the article how separate Input fields for Date/Time parts. I hope, it helps. Quote Link to comment Share on other sites More sharing options...
aam82 Posted March 17, 2015 Author Report Share Posted March 17, 2015 THanks Jan, but I'm not sure I understand. Why is the field called Date/Time if it only accepts Date entries? Or put another way, how do I enter Time into a Date/Time field? It looks to me like it only accepts date. Quote Link to comment Share on other sites More sharing options...
Jan Posted March 18, 2015 Report Share Posted March 18, 2015 Hello aam82, You can add all records with the same date, then you can work with the Time part of records. In the script, you can change the code var date = document.getElementById('cbParamVirtual1').value; if(date == "") date = "1/1/2011"; to var date = "1/1/2011"; And do not create a field for the "Date" part. Then all records will have the same date - 1/1/2011 and the entered Time part. I hope, it helps. I am sorry, if my explanations are unclear. Please ask aam82 1 Quote Link to comment Share on other sites More sharing options...
aam82 Posted March 18, 2015 Author Report Share Posted March 18, 2015 Wow, that's confusing. I haven't tried it yet, but I get it. In fact, now I see that the old Access database that I'm basing my project on used the same method for Time. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
aam82 Posted March 18, 2015 Author Report Share Posted March 18, 2015 FYI, here is what I ended up with: virtual1=receive date parameter from previous page, hidden virtual2=hour dropdown virtual3=minutes dropdown virtual4=am/pm StartTime=hidden virtual5=receive date parameter from previous page, hidden virtual6=hour dropdown virtual7=minutes dropdown virtual8=am/pm EndTime=hidden <script> document.getElementById('Submit').onmouseover = function(){ var date = document.getElementById('cbParamVirtual1').value; if(date == "") date = "1/1/2011"; var hour = document.getElementById('cbParamVirtual2').value; if(hour =="") hour="00"; var minute = document.getElementById('cbParamVirtual3').value; if(minute == "") minute = "00"; var ampm = document.getElementById('cbParamVirtual4').value; document.getElementById('InsertRecordStartTime').value = date + " " + hour + ":" + minute + " " + ampm; document.getElementById('cbParamVirtual5').value; if(date == "") date = "1/1/2011"; var hour = document.getElementById('cbParamVirtual6').value; if(hour =="") hour="00"; var minute = document.getElementById('cbParamVirtual7').value; if(minute == "") minute = "00"; var ampm = document.getElementById('cbParamVirtual8').value; document.getElementById('InsertRecordEndTime').value = date + " " + hour + ":" + minute + " " + ampm; }; </script> Quote Link to comment Share on other sites More sharing options...
Elderberg Posted November 25, 2019 Report Share Posted November 25, 2019 Hi All, I've followed along and got it to work, However I've tested using: 1. cbParamVirutal1 as a Text_Field with calendar option and this was Successful (Note this is as per the example posted above) 2. cbParamVirutal1 as a Hidden_Field with default value and this was Successful cbParamVirutal1 as a Display_Only_Field with default value and this was Unsuccessful cbParamVirutal1 as a Calculated_Value_Field which returns as a text with value 01/01/2011 and this was Unsuccessful var date = document.getElementById('cbParamVirtual1').value; I'm trying to get it working with a Calculated Value, so i can calculate the date automatically and not allow the user to change it. For the curious, below is the code i've used in Calculated_Value_Field (which uses SysDateTime() and the Month() Day() and Year() functions to re-create the date in a mm/dd/yyyy format): CONVERT(VARCHAR(10), Month(SysDateTime() ) ) + '/' + CONVERT(VARCHAR(10), Day(SysDateTime() ) ) + '/' + CONVERT(VARCHAR(10), Year(SysDateTime() ) ) Quote Link to comment Share on other sites More sharing options...
Kurumi Posted October 21, 2022 Report Share Posted October 21, 2022 Hi - Just to add, you may check this forum post for custom date picker with time: Quote Link to comment Share on other sites More sharing options...
Kurumi Posted May 30, 2023 Report Share Posted May 30, 2023 Hi - For Time only fields, you can check this new forum post: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.