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!
Use this:
if (event.value) event.value += "' 0\"";
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)
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...
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";
Copy link to clipboard
Copied
Use this:
if (event.value) event.value += "' 0\"";
Copy link to clipboard
Copied
You are amazing, thank you!
Copy link to clipboard
Copied
What if one wanted to have it display 1'10" entered as 1.10
Copy link to clipboard
Copied
Use this code:
if (event.value) event.value = event.value.replace("'", ".").replace("\"", "");
Copy link to clipboard
Copied
I think this code is converting backwards.
Copy link to clipboard
Copied
I got it to display 5' 2" on a field after entering 5 2 in the form field box
Code: if (event.value) event.value = event.value.replace(" ", "' ");if (event.value) event.value += "\"";
Copy link to clipboard
Copied
Is it possible to use this without the user having to put a space between the numbers?