Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8087537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:48:33+00:00 2026-06-05T18:48:33+00:00

I have a text field. If it has wrong values then it may show

  • 0

I have a text field. If it has wrong values then it may show the alert values and also make the text field empty, but when I use:

textField.text = @"";

after alertView my app hangs and crashes with EXC_BAD_ACCESS.

but when i use textField.text = @"1"; then it works fine, but I want the text field to be empty. How do I do this?

-(void)textFieldTextDidChangeClinicMarkup:(UITextField*)tf{

    NSString*test=clinicMarkupTextField.text;

    if([test isEqualToString:@"1"]) {
        NSString*value=@"1";

        appDelegate.clinicalMarkup=value;
    }
    else if([test isEqualToString:@"1.5"]){
        NSString*value=@"1.5";

        appDelegate.clinicalMarkup=value;
    }
    else if([test isEqualToString:@"2"]){
        NSString*value=@"2";

        appDelegate.clinicalMarkup=value;
    }
    else if([test isEqualToString:@"2.5"]){
        NSString*value=@"2.5";

        appDelegate.clinicalMarkup=value;
    }
    else if([test isEqualToString:@"3"]){
        NSString*value=@"3";

        appDelegate.clinicalMarkup=value;
    }
    else if([test length] >=3 || [test floatValue] > 3 || [test floatValue] <1 )  {
        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"Clinic Markup can only be $1, $1.5, $2, $2.5 and $3 " delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];
        [alert release];

        clinicalMArkupTextfield.text=@"";
    }

} 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T18:48:34+00:00Added an answer on June 5, 2026 at 6:48 pm

    This function is might be called because of you have registered it for text change notification.

    clinicalMArkupTextfield.text=@"";
    

    While you assign blank value by above line, this function will be called again (due to text change notification). Now, none of your condition is satisfied, so it will again come to last else if statement. And it might fall in infinite loop and create a probable crash.

    Otherwise, there seems to be nothing wrong.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text field that is a date, although sometimes it also has
I have an input text field, which has a value something by default, but
I have model Article it has field title with some text that may contain
I have an input text field which has style: visibility: visible or style: visibility:
I have an input field which has a placeholder text. I want one word
I have a text field and am looking to have if be valid for
I have a text field whose length I would like to limit at the
Hi I have a text field which I would like to bind to a
I have my own content type made in my module. It has text and
I have apex tag that generate input text field. <apex:page id=my_page> <apex:inputText id=foo id=c_txt></apex:inputText>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.