Jump to content

Enter Time?


Recommended Posts

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

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

  • 4 years later...

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() ) )  

 

Link to comment
Share on other sites

  • 2 years later...
  • 7 months later...

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
Reply to this topic...

×   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...