Hi ,

my application supports the locale switch and when I am switching to Spanish
locale, the bigDecimal type textfield cannot be recognized the dot (eg.
555.555 is read as 555555 ).

The textfield code is:

final FormBorder q4Border = new FormBorder(
                                "questionFour",
                                new StringResourceModel("forms.cf37.question4", 
this, cf37Model));
                pageTwoForm.add(q4Border);
                
                q4Border.add(new 
TextField<BigDecimal>("question4.rentOrMortgageAmt").add(
new DecimalOnlyValidator()));


----------------------------------
the validator class is :

public class DecimalOnlyValidator extends AbstractValidator<BigDecimal>{

        private static final long serialVersionUID = 1L;

        @Override
        protected void onValidate(IValidatable<BigDecimal> validatable) {
                BigDecimal income =  validatable.getValue();
                if(null!=income){
                        Boolean matchesVal 
=income.toString().matches("[0-9]+([,.][0-9]{1,2})?");
                        if(!matchesVal){
                                
super.error(validatable,"BigDecimalValidator.format");
                        }
                        
                }
        }
}

The weird thing is the income object in the validator class cannot see the
dot of the amount. The dot is working perfectly for English locale(15.55 is
input in the page and income object is still 15.55), but for Spanish, the
dot is missing ( 15.55 input in the page and income object shows 1555 ). 
the screenshot is below
<http://apache-wicket.1842946.n4.nabble.com/file/t375760/2018-01-04_17_54_08-Los_Angeles-Departamento_de_Servicios_Sociales_Publicos-Sus_Beneficios_Ahora.png>
 
<http://apache-wicket.1842946.n4.nabble.com/file/t375760/2018-01-04_17_55_04-PDLVDAPP124.png>
 

Can someone explain it and provide the solution ?


--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to