I have a form that has a text field for a percentage (5 digits with decimal). If the percent is 100.00, the barcode reads 100. Is there a way to capture the percentage without the decimal and keep the trailing zeros in the barcode?
Here is what I have tried:
strValues += oParam.oDoc.getField(strFieldName).value.toString().replace(/\./g'');
with results of 100.
Instead of the value property use the valueAsString property of the field object.
So, you want to display the number in "hundredths of percents".
The easiest way would be to multiply the field's value with 100. If you need the preceeding zeroes, you would use the util.printf() method to format the number with preceding zeroes. You may also need the Math.floor() method to cut off remaining decimal digits. And that should do it.
Also, in my understanding of the replace() method, you'd have to separate the Regular Expression and the replacement string with a comma.
And, in this situation it is better to use the valueAsString property, as already mentioned by Karl Heinz Kremer.