Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Best way to insert Degree symbol?

Avatar

Former Community Member

Hello,

I have an inspection form set up for restaurant/health inspectors.    Often times during an inspection they need to enter temperatures of food and like to use the degree symbol.    They're running this form on a convertible tablet pc, so a normal keyboard is not available to them in tablet mode and when in laptop mode using the combination of ALT+0176 that's still a PITA because the keyboard doesn't have full number pad and the people using this form aren't the most computer literate people out there to be able to activate the Function keys to endable number pad keys and then enter an ASCII code many times during an inspection.

I was looking for suggestion on how to inforporate something into the form to assist in entering the degree symbol in any text field they are in at the position of the cursor.

The idea's I've though of are:

1.) A command button that inserts the symbol, but I'm afraid clicking the button would lose focus of the destination field and there'd need to be a lot of scripting to remember which field was the last one they were in to insert it in the correct one.

2.) A Button or On Load event which somehow inserts the degree symbol into the Windows clipboard, but during the course of an inspection they might copy and paste something else thus clearing it out.

3.) Some kind of auto-replace of text.  Not sure if that's possible in an adobe form.  E.g. if they type 'deg.' have the form auto replace it to '°'.

4.) A special key press.  Not sure if Adobe can listen to a special key sequence not used by Adobe and Windows, say CTRL + D which when pressed inserts a degree symbol in the current location.  

5.) Any way to place a special icon on Adobe's tool bar to insert the degree symbol at the currently location?

Those were some ideas I'm thinking of.  Many are probably dead ends.   If you had this problem, how would you approach it?

Thanks!

-Mike

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

I ended up using a simple replace as I was mentining in my previous post so that if the inspectors types "blah blah blah at 51 deg blah blah blah" and then exits the field, FormCalc will replace the ' deg' with '°F' so that the text now reads "blah blah blah 51°F blah blah blag".

I just need to train my inspectors to type in ' deg' exactly to have it relace it automatically.

//Replace ' deg' with '°F' when user leaves this field.

$.rawValue = Replace($.rawValue, " deg", "°F")

View solution in original post

7 Replies

Avatar

Level 10

The degree symbol can be entered easily by pressing Left Alt + NumPad (167)... which means ascii code 167

but using LiveCycle, the ascii code is 176 so in code it would look like this

text1.rawValue = "20" + String.fromCharCode(176);

Avatar

Former Community Member

Thanks for the reply Robert.  That's good to know when it comes down to programming the actual generation of the symbol, but what I am asking is more about how the user would enter it.   This form has many long text fields which hold more words than just the temperature.  For example a use could enter into a field:     "White fish was a 51°F.  Corrected by throwing it away."

How would the user easilly be able to inset the symbol while in the middle of typing that sentance?

Avatar

Level 10

Well the on the keyboard i depends what is the language set for its keyboard... otherwise everyone would have to enter type:

Left Alt + NumPad(167)... unless they can enter the º by pressing ctrl + alt + 0-9 if they have the character set on a key if not they would have to press ctrl+shift to switch language and see if they have it there...

I suggest you to go with LeftAlt + NumPad(167) much easier

Avatar

Former Community Member

Gotcha.  As mentioned in my OP, we're aware of simply entering ALT+0167, however for computer illterare people who struggle with the concept of copy and paste, that's not really an option.  I'm looking more for something easier for them to quickly insert the symbol.

They are on laptops w/ a normal English keyboard, but they don't have full number pad.  The num pad is shared on the keyboard with normal letter keys.  To do it they've first have to FUNCTION+NumPad to enable it the number pad.    Then ALT+0167 to insert the character.    Then they have to remember to diasable the number pad again with FUNCTION+NumPad so they can finish their typing.     If they need to insert the character, say 5 different times during an inspection, that becomes increasingly burdensome.    That's way to many keystrokes in this setup and tech overload for the end users.  They'll throw the computer out the window if I make them do this.

That's why in the OP I was thinking about some of the brainstormed ideas listed #1 to #5 in the OP and if any of those would be possible.   ...Or any other creative ideas other than ALT+0167.

Avatar

Level 10

Mhmm the best idea i guess would be... on exit event of the field... write this:

var rep = app.popUpMenu("º Farenheit", "º Celsius");

switch (rep){

     case "º Farenheit":

          this.rawValue += "ºF";

          break;

     case "º Celsius":

          this.rawValue += "ºC";

          break;

}

OR

you can have a dropdownlist by the side of each field to change its value from ºC to ºF

OR

you can have a radiobutton list that is predetermined by the user at the beginning of the form, and every time they exit a specificfield the value (ºC or ºF) is added to the field

OR just have a field at the beginning that specifiy what kind of degree the form will represent and have a Label next to each fields that shows the value that is chosen for the degree

Avatar

Former Community Member

Magnus, thanks for not giving up on this yet.   In your last post that is making some progress, but there's also some con's too.

1.) That's running off of an 'On Exit' even which inserts the ºF at the end of the text.   In some cases that would work, but it others it would not work, like in this text field example of real data:      "White fish was a 51°F.  *Corrected* Witnessed manager throw away fish."    

With your proposed java, that would put the °F at the end of the line when it needs to be in the middle of the line.

2.) Many types of written text can be put in these fields.  Not every scenario would involve a temperature, so having it pop up your popupmenu might get in their way when it is not needed.

---

What I'm thinking needs to be done is to somehow insert the °F exactly wherever the cursor is at the time when it is triggered to do so (how to trigger it?).   

OR  

On an On Exit event searcingh for and replacing the text they have entered.   Perhaps replace ' deg' with '°F' so that if they type:

      "White fish was a 51 deg.  *Corrected* Witnessed manager throw away fish."

When the On Exit fires it replace deg with °F so that the text field now reads:

      "White fish was a 51°F.  *Corrected* Witnessed manager throw away fish."

Avatar

Correct answer by
Former Community Member

I ended up using a simple replace as I was mentining in my previous post so that if the inspectors types "blah blah blah at 51 deg blah blah blah" and then exits the field, FormCalc will replace the ' deg' with '°F' so that the text now reads "blah blah blah 51°F blah blah blag".

I just need to train my inspectors to type in ' deg' exactly to have it relace it automatically.

//Replace ' deg' with '°F' when user leaves this field.

$.rawValue = Replace($.rawValue, " deg", "°F")

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----