Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Text Field Properties - Insert degree symbol after field has been filled out with a number like 180

Community Beginner ,
Jun 01, 2018 Jun 01, 2018

I have a text field created and when someone fills it out I want the degree symbol to show up after.

For example, if someone enters the number 180 I want the degree symbol to show up so it looks like 180°.

When I open up Text Field Properties > Format, which one do I use (Custom format script: or Custom keystroke Script" and what is the javascript code for this to occur?

TOPICS
Acrobat SDK and JavaScript , Windows
1.3K
Translate
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

LEGEND , Jun 01, 2018 Jun 01, 2018

Make sure you have copied the presented code exactly. There is a shortcut being used to append the "°" symbol.

Or you can use:

if (event.value != "") event.value = event.value +  "°";

Translate
Community Expert ,
Jun 01, 2018 Jun 01, 2018

Use this code as the field's custom Format script:

if (event.value) event.value += "°";

Translate
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
Community Beginner ,
Jun 01, 2018 Jun 01, 2018

The code is working in regards to placing a degree symbol after the number. The issue occurring now is if I fill the field out as 180, it changes the number to 0 so it looks like  0°. Is there a way to stop this from occurring?

Translate
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
Community Expert ,
Jun 01, 2018 Jun 01, 2018

I tried it and it's not doing that. Make sure you remove any other code you added to that field.

Translate
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
LEGEND ,
Jun 01, 2018 Jun 01, 2018

Make sure you have copied the presented code exactly. There is a shortcut being used to append the "°" symbol.

Or you can use:

if (event.value != "") event.value = event.value +  "°";

Translate
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
Community Beginner ,
Jun 01, 2018 Jun 01, 2018
LATEST

Thank you, this one works perfectly.

Translate
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