Skip to main content
joelb61105383
Participant
May 14, 2022
Answered

Create a field that records time box is checked

  • May 14, 2022
  • 2 replies
  • 930 views

I'm trying to create a simple weekly task list. I want to create a field, in this case it would be "MCB1", that when I press that button, the box (MCB1) will show the current date and time. Although I found a way to populate the date and time in the box, the field updates whenever other box is pressed. I was hoping to find a way to record the date and time and not have field update again.

This topic has been closed for replies.
Correct answer Nesa Nurani

Set condition to populate field only when it's empty:

if(this.getField("MCB1").valueAsString  == ""){
//Your script goes here...
}

2 replies

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
May 14, 2022

Set condition to populate field only when it's empty:

if(this.getField("MCB1").valueAsString  == ""){
//Your script goes here...
}
Bernd Alheit
Community Expert
Community Expert
May 14, 2022

What script does you use? Where does you use the script?

joelb61105383
Participant
May 14, 2022

This is the one I found online. MB1 is a check box that you would have to push to fill in the date/time for MCB1.

event.value = this.getField("MB1").value=="Off" ? "" : util.printd("HH:MM", new Date());