Highlighted

Convert number to feet & inches

Explorer ,
Jul 23, 2020

Copy link to clipboard

Copied

Good morning, 

 

I need a hand please with code that takes height and converts it to a more detaliked version. 

 

Height would be entered like this for feet & inches: 600 (which means 6 feet & 0 inces). I would like it to to display as multi line like this please: 

 

Ft 6

In, 00

 

Thank you in advance. 

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

Views

156

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

Convert number to feet & inches

Explorer ,
Jul 23, 2020

Copy link to clipboard

Copied

Good morning, 

 

I need a hand please with code that takes height and converts it to a more detaliked version. 

 

Height would be entered like this for feet & inches: 600 (which means 6 feet & 0 inces). I would like it to to display as multi line like this please: 

 

Ft 6

In, 00

 

Thank you in advance. 

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

Views

157

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
Jul 23, 2020 0
Explorer ,
Jul 23, 2020

Copy link to clipboard

Copied

Is this even doable? lol

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...
Jul 23, 2020 0
Most Valuable Participant ,
Jul 23, 2020

Copy link to clipboard

Copied

How would you know if 111 means 11 feet and 1 inch or 1 foot and 11 inches?
You can only do it if the value has to be 4 numbers, for example, or if you artificially cap the maximum (and minimum) values, by assuming the value can't be lower than X or higher than Y. Either way, it's tricky.

 

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...
Jul 23, 2020 1
Explorer ,
Jul 23, 2020

Copy link to clipboard

Copied

So would it be best to use: Ft: 06 | In. 06 = 0606? Could it be done then? Chances of a 10 foot person or 1 foot person completing this are very slim, but I am okay with it being a four number format. 

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...
Jul 23, 2020 0
Most Valuable Participant ,
Jul 23, 2020

Copy link to clipboard

Copied

It is possible to do it so that if there are 3 digits it assumes the first one is feet and the last two are inches, and if there are are two it's one for each, I guess.

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...
Jul 23, 2020 1
Explorer ,
Jul 23, 2020

Copy link to clipboard

Copied

Either way will work for me 🙂 

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...
Jul 23, 2020 0
Most Valuable Participant ,
Jul 24, 2020

Copy link to clipboard

Copied

But do you want it converted in the same field, or to show the multi-line value in a different field?

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...
Jul 24, 2020 1
Explorer ,
Jul 24, 2020

Copy link to clipboard

Copied

Happy Friday, 

 

I would like it to convert into the multi line value format in the same field, if possible. 

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...
Jul 24, 2020 0
Explorer ,
Jul 26, 2020

Copy link to clipboard

Copied

This is the last thing I need to figure out. lol

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...
Jul 26, 2020 0
Most Valuable Participant ,
Jul 26, 2020

Copy link to clipboard

Copied

You can use this code as the field's custom Format script:

if (event.value) event.value = "Ft " + event.value.charAt(0) + "\nIn, " + event.value.substring(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...
Jul 26, 2020 1
Bob-Dole LATEST
Explorer ,
Jul 26, 2020

Copy link to clipboard

Copied

WOW, perfect! Danke!

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...
Jul 26, 2020 0