invalid formatter values

  • Hello,

    I have a number formatter on a text field to reject values less than
    zero. I want to make it so that it will revert the value to the
    pervious value and not call the action function for invalid values. I
    have control:didFailToFormatString:errorDescription: return NO, but
    the action function is still called. Is there a way to not call it
    when the value is invalid, and is there a straight-forward way to set
    the field to the previous, valid value?

    Thanks,
    Mitchell Livingston
  • on 11/13/07 9:35 PM, <livings124...> purportedly said:

    > I have a number formatter on a text field to reject values less than
    > zero. I want to make it so that it will revert the value to the
    > pervious value and not call the action function for invalid values. I
    > have control:didFailToFormatString:errorDescription: return NO, but
    > the action function is still called. Is there a way to not call it
    > when the value is invalid, and is there a straight-forward way to set
    > the field to the previous, valid value?

    It would likely be easier to use a custom formatter that disallows entering
    a dash (minus sign). Then the numbers entered will always have to be
    positive.

    My philosophy has been--and I believe it is consistent with HIG--that it is
    better to not let the user do something than it is to let them do something
    wrong and them tell them so, or, in your case, beep and revert the value.

    Best,

    Keary Suska
    Esoteritech, Inc.
    "Demystifying technology for your home or business"
  • Through experimentation, I have found that removing the binding on the
    text field (in this case I was just binding the "enabled" value)
    resolves the problem. However, I do not want to lose this
    functionality. Is there something I can do to get this working?

    Thanks,
    Mitchell Livingston

    On Nov 13, 2007, at 11:35 PM, Mitchell Livingston wrote:

    > Hello,
    >
    > I have a number formatter on a text field to reject values less than
    > zero. I want to make it so that it will revert the value to the
    > pervious value and not call the action function for invalid values.
    > I have control:didFailToFormatString:errorDescription: return NO,
    > but the action function is still called. Is there a way to not call
    > it when the value is invalid, and is there a straight-forward way to
    > set the field to the previous, valid value?
    >
    > Thanks,
    > Mitchell Livingston
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today