Bug with xpage number field

Steps to reproduce:1. Add number field to xpage

  1. Set display type → Number

  2. Set display format → Decimal

  3. Add eg. number 8585 to field

  4. Refresh page(Save or do Full Update through action)

  5. Do step 5 again and you’ll get error: Field value is not valid number.

This happens because xpage automatically adds thousand separator to field and therefore value cannot be validated.

Subject: This works for me. Am I missing something…

Here’s what I got

<xp:inputText id="inputText1" value="#{document1.number}">

	<xp:this.converter>

		<xp:convertNumber type="number"></xp:convertNumber>

	</xp:this.converter>

</xp:inputText>

And it works for me. Or am I missing something.

p.

Subject: Number Fields Format Problem - my strange solution

The problem comes with formatting the number.

If I create a number field with no formatting - it works fine.

If I create a number field that has some formatting (which just about all them will have), the problems start.

Here is what happens:

  1. Select Display Format of Custom

  2. Select #,##0

  3. Save the control/xpage

  4. It works fine

… then

  1. Re-edit that field

  2. You will see that the display format has now switched back to decimal but the pattern is still there. But you can not edit it.

If you look at the source - it has type=number in there now. This is not in there when you select custom.

  1. Resave the control/xpage

  2. The field will no longer work correctly. If the user enters #,### it will fail.

  3. The real crazy part is for existing data - it will display in the format you specify, but when you save it - it must be without the commas. So you can not resave your forms without removing commas from all number fields.

To band-aid it - I entered a javascript formula for the number format. It seems to be working. Here’s the code I used to make it work:

<xp:inputText value=“#{doc.numField}” id=“numField”>

xp:this.converter

<xp:convertNumber type=“number”>

xp:this.pattern</xp:this.pattern>

</xp:convertNumber>

</xp:this.converter>

</xp:inputText>