cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Getting a Field with "Time only" in Nintex Forms

Hi fellow Nintex Admins,

in InfoPath i can set a text field to "time". Is there a way to achieve this with Nintex Forms?

Cheers

Daniel

Labels: (3)
Tags (1)
0 Kudos
Reply
10 Replies
Workflow Hero

Re: Getting a Field with "Time only" in Nintex Forms

If you have a date with time you can extract just the time using the Build string action and save it to a variable/text field:

fn-FormatDate({ItemProperty:Modified}, "t")

If you want to capture the current time you can use the Current Time reference and save it to a variable/text field.

2016-04-19_10-04-38.png

Hope this helps.

Accept as Solution Reply
Workflow Hero

Re: Getting a Field with "Time only" in Nintex Forms

Hi Igor,

thank you for your answer, but this is not what i am looking for.

In my case, the user has to add hours / minutes. I have a date / time field in the same form, so it would be nice to stay in the same usability logic.

Accept as Solution Reply
Workflow Hero

Re: Getting a Field with "Time only" in Nintex Forms

In this case you might want to use the Calculate date action and add hours/minutes to the existing date.

Accept as Solution Reply
Workflow Hero

Re: Getting a Field with "Time only" in Nintex Forms

I think wie are talking about different things

The user has to fill out a Nintex Form in a library. In this form is a field, where the user has to add a time. There is no date or no workflow involved in this situation:

Uhrzeit = time

Cheers

Daniel

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Getting a Field with "Time only" in Nintex Forms

So I think it looks like you're looking at a text box with a set format so it's input in time. Perhaps Regex validation would be your best bet?

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Getting a Field with "Time only" in Nintex Forms

So why not just use the date & time format?

2016-04-22_8-12-34.png

You can then format and display it in multiple ways.

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Getting a Field with "Time only" in Nintex Forms

Cause i have only one date but multible time fields

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Getting a Field with "Time only" in Nintex Forms

Hey Daniel,

What did you end up doing to make your multiple time fields work? I have multiple time fields then I need to calculate the duration of the work on my form.

So yea, I have the same question.

Thanks

Kassie

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Getting a Field with "Time only" in Nintex Forms

I had a situation where I needed the user to only input the time portion of the Date/Time and the customer wanted to restrict the time entry to 5 minute intervals. I though great, I'll just use the Date/Time picker, but the customer did not want the date field to be exposed. So, here's what I did.

#1. Hide the Date field in the Custom JavaScript.

NWF.FormFiller.Events.RegisterAfterReady(function () {
    document.getElementsByClassName('nf-date-picker')[0].style.visibility = 'hidden';
});

I found this would hide the date field, but left the calendar button on the form.

#2. Redefine the Date/Time picker. Added the following to the Custom JavaScript. (Note I use the empty.gif for the button).

function nfInitDatePicker() {
 NWF$(".nf-date-picker").datepicker({          
  showOn: "button",
  buttonImage: "/_layouts/15/images/empty.gif"
  buttonImageOnly: true,
  changeMonth: true,
  changeYear: true,
  showOtherMonths: true,
  selectOtherMonths: true,
  showButtonPanel: true,
  dateFormat: "m/d/yy",
  nextText: "Next",
  prevText: "Prev",
  buttonText: "",
  currentText: "Today",
  closeText: "Done",
  monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
  monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
  isRTL: false,
  dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
  dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
  dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  firstDay: 0,
  onSelect: function() {
    var that = NWF$(this);
    this.fireEvent && this.fireEvent('onchange') || that.change();
    try{
      if (this.fireEvent != undefined) {
        that.change();
      }
    }
    catch(e) { };
    if (that.blur) (that.blur());
  },
  beforeShow: function(input, inst) {
  }
 });  
 var dateControls = NWF$('.nf-date-picker:disabled:visible');
 var dateControlsCount = dateControls.length;
 for (k = dateControlsCount - 1; k >= 0; k--) {                      
  NWF$(dateControls).datepicker('disable');
 }
}

#3. Remove the default control and use our new defined control. (Just added 2 lines to step #1)

NWF.FormFiller.Events.RegisterAfterReady(function () {
    document.getElementsByClassName('nf-date-picker')[0].style.visibility = 'hidden';
    nfFillerLoadFunctions.pop(); // Discard the default datepicker initializer
    nfFillerLoadFunctions.push(nfInitDatePicker); // Insert our own datepicker initializer
});

In the design the fields still appear, so placing them on the form takes a little imagination.

But when displayed on the entry or display form, it works.

Hope this works for you.

Accept as Solution Reply