Skip to main content
tacnola
Known Participant
February 7, 2022
Answered

Copy and Paste Button Using JS With 0 as the Lead

  • February 7, 2022
  • 2 replies
  • 615 views

I am needing a script so that I can create a COPY/PASTE button that will copy/paste multiple fields.

The field value will be time showing as a 5 digit (00:00), so there will be at times a 0 as the leading value in the field. 

I have search for an answer and was able to get the button to work, but not on the 0-lead fields. ie 08:00 would show as 800. (I don't know if it matters, but the user will enter 0800 and the field will change it to 08:00.) It seems to work perfectly with all the other fields. 

I have read to add valueAsString to the script, but obviously I have no idea what I'm doing. Here is what I am working with:

this.getfield("SunRow3").value = this.getfield("SunRow1").valueAsString;

Thank you in an advance for any assistance. 

This topic has been closed for replies.
Correct answer try67

It's getField, not getfield. JS is case-sensitive...

2 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
February 7, 2022

It's getField, not getfield. JS is case-sensitive...

tacnola
tacnolaAuthor
Known Participant
February 7, 2022

That was it! Thank you!

Bernd Alheit
Community Expert
Community Expert
February 7, 2022

What format does you use at field "SunRow3"?

tacnola
tacnolaAuthor
Known Participant
February 7, 2022

 I have this currently in the Custom Format Script that changes the simple input format from the 0800 to 08:00...

if (event.value.length==4) event.value = event.value.substring(0,2) + ":" + event.value.substring(2);