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?
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 + "°";
Copy link to clipboard
Copied
Use this code as the field's custom Format script:
if (event.value) event.value += "°";
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?
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.
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 + "°";
Copy link to clipboard
Copied
Thank you, this one works perfectly.