• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSNumberFormatter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNumberFormatter


  • Subject: Re: NSNumberFormatter
  • From: Chuck Hill <email@hidden>
  • Date: Fri, 12 Jul 2013 17:00:55 -0700

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      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden

--
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      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: NSNumberFormatter
      • From: Ingenieurbüro Birnfeld - Oliver Birnfeld <email@hidden>
References: 
 >NSNumberFormatter (From: Ingenieurbüro Birnfeld - Oliver Birnfeld <email@hidden>)

  • Prev by Date: Re: create new to-many objects in d2w
  • Next by Date: Re: javamonitor and wotaskd won't start after os x updates
  • Previous by thread: NSNumberFormatter
  • Next by thread: Re: NSNumberFormatter
  • Index(es):
    • Date
    • Thread