javascript for automatic time format

Explorer ,
Aug 22, 2018

Copy link to clipboard

Copied

Hello my dears, I'm looking for a script for a text box in which I enter the time. At the moment I have assigned the field a format (HH: MM), and if the user enters HH.MM he gets an alert. But I would like the field to automatically switch to my chosen format (similar to an Excel spreadsheet). So:  the user types 9.30 and in my text field appears 09:30. Is there a script for it? (Acrobat Pro DC 2018) Can someone help? Thanks in advance!

TOPICS
Acrobat SDK and JavaScript, Macintosh

Views

205

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

javascript for automatic time format

Explorer ,
Aug 22, 2018

Copy link to clipboard

Copied

Hello my dears, I'm looking for a script for a text box in which I enter the time. At the moment I have assigned the field a format (HH: MM), and if the user enters HH.MM he gets an alert. But I would like the field to automatically switch to my chosen format (similar to an Excel spreadsheet). So:  the user types 9.30 and in my text field appears 09:30. Is there a script for it? (Acrobat Pro DC 2018) Can someone help? Thanks in advance!

TOPICS
Acrobat SDK and JavaScript, Macintosh

Views

206

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
Aug 22, 2018 0
Most Valuable Participant ,
Aug 23, 2018

Copy link to clipboard

Copied

To do that you would need to create your own Keystroke, Format and possibly Validation scripts.

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...
Aug 23, 2018 0
Explorer ,
Aug 23, 2018

Copy link to clipboard

Copied

I thought so. Unfortunately, my javascript is not good enough to do that. I thought maybe someone knows a script, which I can then enter in the calculation ...

At the moment the user just gets this message "The entered value does not match the format of the field"- and that is not user friendly...Meldung.jpg

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...
Aug 23, 2018 0
Adobe Community Professional ,
Aug 23, 2018

Copy link to clipboard

Copied

Set the format to "None" and see what happens.

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...
Aug 23, 2018 0
Explorer ,
Aug 23, 2018

Copy link to clipboard

Copied

that's not what I want - I want HH: MM to always be in the filled-in format - no matter how the user types it...

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...
Aug 23, 2018 0
Adobe Community Professional ,
Aug 24, 2018

Copy link to clipboard

Copied

Read reply 1.

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...
Aug 24, 2018 0
Adobe Community Professional ,
Aug 24, 2018

Copy link to clipboard

Copied

You should be aware that some users track time in decimal hours, so 9.30 might mean 9:18 (30/100 of an hour) and not 9:30.  How would you treat values like 9-30, 9 30 or 9.50?

This might not be as simple as you would like.There are some good reasons there is a different format for time from decimal numbers.

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...
Aug 24, 2018 0