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

Mouse up code to enter current time HH:MM in multiple fields with same parent name

Community Beginner ,
Jul 27, 2018 Jul 27, 2018

Copy link to clipboard

Copied

I have a time field that enters the current time when I enter the field (acroform).

I was able to do this successfully with the code below.  However, I would like to copy this field multiple times (T1.0, T1.1, etc..) and not have to enter and change the javascript in each field.  Any wildcard to replace "T1.0" with the reference to the same field? I'm sure this is a very elementary question but I haven't been able to figure this out or find it.

var f = this.getField("T1.0") //target field to copy over

if (f.value != null && f.value != "")

{

} else {

   f.value = util.printd("HH:MM", new Date());

}

TOPICS
Acrobat SDK and JavaScript

Views

316

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Jul 27, 2018 Jul 27, 2018

Replace the first line with:

var f = event.target;

Votes

Translate

Translate
Community Expert ,
Jul 27, 2018 Jul 27, 2018

Copy link to clipboard

Copied

Replace the first line with:

var f = event.target;

Votes

Translate

Translate

Report

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 Beginner ,
Jul 27, 2018 Jul 27, 2018

Copy link to clipboard

Copied

LATEST

Thank you! Works perfectly!

Votes

Translate

Translate

Report

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