Populating and clearing a text field based on another text field

Community Beginner ,
Jun 19, 2022 Jun 19, 2022

Copy link to clipboard

Copied

I want a text field (DateField1) to display the current date when a text field (Name1) has any value inputed into it. My validation script works to populate the date field but I cant figure out the script to clear the date field when the text field (Name1) has no value inputted. Here is the first part of the script that is validating in the text field (Name1)

 

this.getField("DateField1").value = new Date();

TOPICS
JavaScript , PDF forms

Views

32

Likes

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

Adobe Community Professional , Jun 19, 2022 Jun 19, 2022

Use this:

this.getField("DateField1").value = event.value == "" ? "" : new Date();

Likes

Translate

Translate
Adobe Community Professional ,
Jun 19, 2022 Jun 19, 2022

Copy link to clipboard

Copied

LATEST

Use this:

this.getField("DateField1").value = event.value == "" ? "" : new Date();

Likes

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