Need help turning a number entered into a PDF into feet and inches

New Here ,
Jul 05, 2018 Jul 05, 2018

Copy link to clipboard

Copied

Hi, I'm not a Javascript pro and am looking to add the symbol for feet, and inches into a PDF fillable form field.

To be clear, my client would like to enter the number of feet and have it return (appended) with the feet symbol as well as 0 inches.

So for example, if I were to input 30 into the field, I would like it to return the number formatted as  30' 0".

Any help is greatly appreciated! I know it's not a difficult script, but as I said, I am quite lost when it comes to js.

Thanks!

TOPICS
PDF forms

Views

237

Likes

translate

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

Most Valuable Participant , Jul 05, 2018 Jul 05, 2018
Use this:if (event.value) event.value += "' 0\"";

Likes

translate

Translate

Translate
Most Valuable Participant ,
Jul 05, 2018 Jul 05, 2018

Copy link to clipboard

Copied

You need to better explain how this is supposed to work. How would they enter 30' 6", for example? 30.5? 30.6? Something else?

Also, do you want to change the actual value of the field, or just how it is displayed? Or maybe use two separate fields? (I think that's a better approach, personally)

Likes

translate

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
New Here ,
Jul 05, 2018 Jul 05, 2018

Copy link to clipboard

Copied

Thank you for responding try67!

They would like to enter the number, then have the number show up (unchanged) with the feet symbol, followed by 0" (inches will always be 0). They need to be in the same field.

So if they enter "50", it should appear on the form (in the text field) as 50' 0".

I have figured out how to get it to show in feet with the zero following, just having trouble getting the inch marks in as well...

Likes

translate

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
New Here ,
Jul 05, 2018 Jul 05, 2018

Copy link to clipboard

Copied

I used the below to get it somewhat working...

// Custom Format script for text field 

if (event.value) event.value += "'" + "0";

Likes

translate

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
Most Valuable Participant ,
Jul 05, 2018 Jul 05, 2018

Copy link to clipboard

Copied

Use this:

if (event.value) event.value += "' 0\"";

Likes

translate

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
New Here ,
Jul 05, 2018 Jul 05, 2018

Copy link to clipboard

Copied

You are amazing, thank you!

Likes

translate

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
New Here ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

What if one wanted to have it display 1'10"  entered as 1.10

Likes

translate

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
Most Valuable Participant ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

Use this code:

 

if (event.value) event.value = event.value.replace("'", ".").replace("\"", "");

Likes

translate

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