Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Auto populate form fields with 15 minute increments

New Here ,
Jun 22, 2021 Jun 22, 2021

I want to make it so that it will auto populate the times like below. So if i put 2:00 pm on the first one it will show 2:15 pm on the next one. So far i got this working on foxit editor with the code below. Any idea on how I can get it working on adobe acrobat too?

if(this.getField("Time CheckedRow10").value!="")
{
var minutesadd= 15
var btest= this.getField("Time CheckedRow10")
var time= new Date("01-01-1970 "+ btest.value);
time.setTime(time.getTime()+minutesadd*60000)
event.value=util.printd("hh:MM tt",time);
}

Acrobat_SSEnaFcxQm.png

TOPICS
Create PDFs , JavaScript , PDF forms
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Jun 22, 2021 Jun 22, 2021

Change this line:

var time= new Date("01-01-1970 "+ btest.value);

To:

var time= util.scand("hh:MM tt","01-01-1970 "+ btest.value);

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 22, 2021 Jun 22, 2021

I see no reason it shouldn't work in Acrobat. What happens when you use it?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 22, 2021 Jun 22, 2021

shows as 12:00 am. Is there another way to do this that i can try?

Acrobat_iaa2ohWDHL.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 22, 2021 Jun 22, 2021

Change this line:

var time= new Date("01-01-1970 "+ btest.value);

To:

var time= util.scand("hh:MM tt","01-01-1970 "+ btest.value);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 22, 2021 Jun 22, 2021

OMG TYTYTY!!! hahaha i should have asked earlier stuck on this for 2 days already

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 05, 2023 Jan 05, 2023

Is there a way to copy this script into the form field properties without having to change the field name to add the 15 minutes to each time? I have increments of 15 minutes and there are 96 entries for a day's time (24 hours in 15 minute increments).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 05, 2023 Jan 05, 2023

When I change the first box which should autopopulate the entire row, only the first 3 boxes populate correctly and the rest remain as they previously were. They work if I go into the javascript individually, but that defeats the purpose. HELP!!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 06, 2023 Jan 06, 2023
LATEST

- If the fields are named consistently then you can do it using a script under the first field. You don't need to duplicate the code to the other fields.

- Did you check the JS Console for errors?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines