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

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

Copy link to clipboard

Copied

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

Views

386

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
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 +  "°";

Likes

Translate

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

Copy link to clipboard

Copied

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

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

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

Copy link to clipboard

Copied

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?

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

Copy link to clipboard

Copied

I tried it and it's not doing that. Make sure you remove any other code you added to that 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
community guidelines
LEGEND ,
Jun 01, 2018 Jun 01, 2018

Copy link to clipboard

Copied

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 +  "°";

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

Copy link to clipboard

Copied

LATEST

Thank you, this one works perfectly.

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
community guidelines