Formatting a decimal variable to decimal places loses formatting in firefox - formatting

I have a decimal variable value I set scale two decimal places that is displayed into an input field. The visualforce page uses dynamic updating of this field and it works great. The problem is when I use firefox all decimal fomatting is removed, its like it turns to an int. (the inclusivePriceDisplay populates the incl input field). I cannot use the currency formatting field because of a calculation I am not saving to the record as one of my fields, inclusivePrice is not included on any object so does not have the salesforce currency formatting.
how it looks ext class:
decimal inclusivePriceDisplay= inclusivePrice.setScale(2, RoundingMode.HALF_UP);
How it looks VFP:
<apex:input required="true" value="{!inclusivePriceDisplay}" type="number" label="{!$Label.InclPrice}">
</apex:input>
How it looks on Chrome:
How it looks firefox:
Its like if its a whole number it refuses to put the trailing zeros and the decimal. I even initialize the variables to 0.00 and it only shows to 0. However if the decimal should be more than 2 decimals it will show 2 decimals but if it is like $1.10 (a dollar and ten cents) it will only show 1.1.

Related

Set precision of shown attribute in autocad dynamic block

I made a blog that shows it current with and height in the displayed thext.
Now they have 4 decimal places (for example 5.600), see picture below.
I want them displayed with only 1 decimal place, how can i do this?
(example below would become 5.6x16.5 in stead of 5.6000x16.5000)
You can either modify the Precision property of the Field formatting so as to round the result to 1 decimal place:
Or, if you were looking to retain the precision, you could instead suppress trailing zeroes within the Additional Format options:
Alternatively, assuming that your formatting is set to Current units, you could change the value of your LUPREC system variable.

Using and displaying more than 2 decimal places

I want to use more than 2 decimal places to make calculations with my MS Project project.
So far i wasn't able to find any resource which tells how to show more than 2 decimal in a field (like Work or cost, for example), neither how to truncate numbers instead of rounding them (lets say, USD 12.357 to USD 12.35 instead of USD 12.36).
Is there any way of doing this? It could be through VBA or any method you can come up with.
You can use more than 2 decimal places, just not in the user interface.
The UI truncates displayed and entered values to 2 decimals. However, values entered and accessed via VBA do not have this limitation.
For example, using the Intermediate window (VBA), enter the cost for the first two tasks of the active project and then request the values to prove they are stored as entered, up to 16 digits:
ActiveProject.Tasks(1).Cost = 0.1234567890123456789
ActiveProject.Tasks(2).Cost = 123456789012.123456789
? ActiveProject.Tasks(1).Cost
0.123456789012346
? ActiveProject.Tasks(2).Cost
123456789012.123
To show the value in the UI as stored, customize a text field using the Format function:

typo3 fluid format number without trailing zeros

In my typo3 extension I got a double value saved via backend. I want to put this value out in the frontend.
I want the double to be formated to use the german ',' as decimal seperator (and a max precision of 1). So I used f:format.number viewhelper to set this. However that fluid helper ist setting fixed decimals. I want dynamic decimals, as in I do not want any trailing 0s. 4.0 ought to be shown as 4.
If I do not use the viewhelper (thus outputting the raw data) the behaviour is as desired. 4.0 shows as 4, however it also does show 4.5 as 4.5 not as 4,5.
Is there a way to 'unfix' the decimals in the viewhelper?
I also tried to wrap my output in if conditions to check via modula, but this never returns a positive.
How do I output formated doubles on a precision without trailing zeros?
For just one digit (like in your example) the following code worked for me. For a double, you have to nest another if-condition in the else case since there is no else-if in fluid.
<f:if condition="{number} == {number -> f:format.number(decimals: 0)}">
<f:then>
<f:format.number decimals="0" decimalSeparator=",">{number}</f:format.number>
</f:then>
<f:else>
<f:format.number decimals="1" decimalSeparator=",">{number}</f:format.number>
</f:else>
</f:if>

Cannot input positive number when using NSNumberFormatter?

I'm using NSNumberFormatter for my NSTextField to make numbers like 1.23 display as +1.23 and -1.23 as -1.23. Everything works fine, until I tried to input directly into the text field.
If I typed in 1.23 and hit return, the form rejected the number by complaining the invalid format. What is wrong here?
I've set the format in IB completely, the the Format(+) field is +0.00, and Format(-) field is -0.00. I've also restricted the Fraction Digits to 2, Positive Prefix to + and Negative Prefix to - respectively.
How can I fix this?
You can easily do it like this:

Negative dollars and iTextSharp

I am trying to assign a form field in a PDF through iTextSharp that has a negative dollar amount. The value is a simple string that starts with '-$'. Every time I add the value to the form using SetField, anything after the negative sing is lost. Positive dollar amounts are fine, only negative values are lost.
I am adding the value as such:
form.SetField(fieldName, fieldValue);
form is of type AcroFields, fieldName and fieldValue are both strings. I have traced down to the point where the string is being passed to SetFields, and its right there. I have also tried replacing '$' with the Unicode value to no avail. Am I supposed to escape the dollar sign? And if so, does anyone know what the escape character is?
I fixed the issue though I do not totally understand the cause. The field was defined as a multi-line text box even though it was being used as a single line. I unchecked the option for the box to be multi-line and the issue went away.