• 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: self-validating text fields (SOLVED)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: self-validating text fields (SOLVED)


  • Subject: Re: self-validating text fields (SOLVED)
  • From: Mike Abdullah <email@hidden>
  • Date: Thu, 30 Mar 2006 10:40:39 +0100

Hey Daniel, thanks for the response.

Yeah, I had experimented with the isPartialStringValid function, but this didn't completely fill my need. Say for example, the user put nothing in the box, I wanted it to change to a 0 when they ended editing. Similarly. I have date boxes that allow the user to enter the date using natural language (e.g. "Tomorrow at 5 pm"). In that case as well, I wanted the field to validate itself and display the nicely formatted date.

So, after a fair bit of digging, I eventually found that I was actually on the right track with the term "Validation." I had to tick the "Validates Immediately" box in Interface Builder, and then write a validate<KEY>: method in my data that does the validation.

One thing I did find though, is that if you return the same date as you have been given from one of these methods, the date fields will still not update themselves, because the Bindings system thinks they are the same. Instead, I found that returning the date plus one milisecond will do the trick.

Mike.

On 30 Mar 2006, at 03:16AM, Daniel Waylonis wrote:

On Mar 27, 2006, at 2:52 PM, Mike Abdullah wrote:

Dear list,

In my app, I have a text field that is bound to a particular key of its data model. [...]

Hi Mike,

Have you tried attaching a special formatter (e.g., NSNumberFormatter, NSDateFormatter) of your own creation that implements isPartialStringValid: ? I've used that before to make sure that I constrain the input to my liking (e.g., only positive integers).

Dan
-----------------------------------------------------------------
Dan Waylonis                    email@hidden
nekotech SOFTWARE
http://www.nekotech.com
650.964.2490 Voice / Fax



_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >self-validating text fields (From: Mike Abdullah <email@hidden>)

  • Prev by Date: Re: Pop up window ala msn messenger
  • Next by Date: Re: distribution app (was: disk image making)
  • Previous by thread: self-validating text fields
  • Next by thread: NSURL from a sidebar plist entry (object for key "Alias")?
  • Index(es):
    • Date
    • Thread