Is the original value zero?  WO might be short-circuiting something if the 
value does not change.  Also try 0 as the format pattern:

> inputFormatter=new NSNumberFormatter("0");


Chuck


On 2013-07-12, at 5:21 AM, Ingenieurbüro Birnfeld - Oliver Birnfeld wrote:

> Hi,
> 
> I have a problem using NSNumberFormatter to validate the input of an 
> WOTextField. When e.g. setting formatter.setMinimum(5) and 
> formatter.setMaximum(20) then validationFailedWithException is called for all 
> values <0, >20, and 1-4 but _not_ for 0.
> 
> Here are some code snippets:
> 
> Constructor:
> inputFormatter=new NSNumberFormatter("#");
> inputFormatter.setMaximum(new BigDecimal(20));
> inputFormatter.setMinimum(new BigDecimal(5));
> 
> 
> public void validationFailedWithException(Throwable t, Object value, String 
> keyPath) {
>    if( keyPath.equals("value")) {
>        warningVisible=true;
>    }
>    validationError=true;
>    super.validationFailedWithException(t, value, keyPath);
> }
>       
> public WOActionResults saveSettings() {
>    if( validationError) {
>        validationError=false;
>        return null;
>    }
>    return pageWithName("Main");
> }
> 
> The html code looks like this:
> 
> <wo:textfield value="$value" formatter="$inputFormatter" />
> 
> 
> Am I missing something?
> 
> Thanks!
> 
> Regards,
> Oliver
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
> 
> This email sent to ch...@global-village.net

-- 
Chuck Hill             
Executive Managing Partner, VP Development and Technical Services

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.    
http://www.global-village.net/gvc/practical_webobjects

Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing 
Companies in B.C! 

Global Village Consulting ranks 44th in 25th annual PROFIT 500 ranking of 
Canada’s Fastest-Growing Companies by PROFIT Magazine!













 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to