Click checkbox to auto populate text box with current time

Community Beginner ,
Apr 17, 2020

Copy link to clipboard

Copied

script.JPG

 

Hello, 

Please help. I am looking for a script that can associate a checkbox and a text field formated to display the current time (hhmm 2400 hours format). When a check box is clicked the text box should display the current time as read only. This is for QA and making sure certain tasks are completed within a certain time frame. Is there a code I can use for this? I really appreciate any help you can provide

Thank you ! 

TOPICS
Acrobat SDK and JavaScript, Create PDFs, How to, PDF forms

Views

46

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

Click checkbox to auto populate text box with current time

Community Beginner ,
Apr 17, 2020

Copy link to clipboard

Copied

script.JPG

 

Hello, 

Please help. I am looking for a script that can associate a checkbox and a text field formated to display the current time (hhmm 2400 hours format). When a check box is clicked the text box should display the current time as read only. This is for QA and making sure certain tasks are completed within a certain time frame. Is there a code I can use for this? I really appreciate any help you can provide

Thank you ! 

TOPICS
Acrobat SDK and JavaScript, Create PDFs, How to, PDF forms

Views

47

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
Apr 17, 2020 0
Most Valuable Participant ,
Apr 17, 2020

Copy link to clipboard

Copied

What should happen when the check-box is unticked?

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
Reply
Loading...
Apr 17, 2020 1
Community Beginner ,
Apr 17, 2020

Copy link to clipboard

Copied

When the box is unchecked the text field should be cleared. That way when the operator can correct the time entry by checking the box again if needed.

Thank you 

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
Reply
Loading...
Apr 17, 2020 0
Most Valuable Participant ,
Apr 17, 2020

Copy link to clipboard

Copied

Let's say the text field is called "QATime". Enter this code as the MouseUp event of the check-box:

this.getField("QATime").value = (event.target.value=="Off") ? "" : util.printd("HH:MM", 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
Reply
Loading...
Apr 17, 2020 1
Community Beginner ,
Apr 17, 2020

Copy link to clipboard

Copied

Works like a charm! I thank you so much for what you do! 

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
Reply
Loading...
Apr 17, 2020 0