Skip to main content
Inspiring
June 1, 2018
Answered

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

  • June 1, 2018
  • 1 reply
  • 1480 views

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?

This topic has been closed for replies.
Correct answer gkaiseril

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

1 reply

try67
Community Expert
Community Expert
June 1, 2018

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

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

Inspiring
June 1, 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?

try67
Community Expert
Community Expert
June 1, 2018

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