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 8481463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:33:50+00:00 2026-06-10T19:33:50+00:00

Hi i have a minimum value as 100 and maximum value as 400. User

  • 0

Hi i have a minimum value as 100 and maximum value as 400. User should enter within this values. If they enter 400.5 it shouldn’t accept. that is the validation for my textfield. I used the following code

    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
                [formatter setNumberStyle:NSNumberFormatterDecimalStyle];
                NSNumber *textFieldNumber = [formatter numberFromString:[dynamicHealthyHeartTxtFld text]];
                NSNumber *MaxNumber = [formatter numberFromString:[[healthyHeartFieldsAry objectAtIndex:getHHTag] objectForKey:@"MaxVal"]];
                NSNumber *MinNumber = [formatter numberFromString:[[healthyHeartFieldsAry objectAtIndex:getHHTag] objectForKey:@"MinVal"]];


                if ([self checkForDecimalValue:dynamicHealthyHeartTxtFld.text]) 
                {





                    if (([textFieldNumber decimalValue] < [MinNumber decimalValue]) || ([textFieldNumber decimalValue] > [MaxNumber decimalValue]) ) {

                        if ([textFieldNumber decimalValue] < [MinNumber decimalValue]) {

                            Custom_Alert *alert=[[Custom_Alert alloc] initWithTitle:@"Alert" message:[NSString stringWithFormat:@"The Value you entered in %@ is outside the acceptable range.Please correct and Continue ",[[healthyHeartFieldsAry objectAtIndex:getHHTag] objectForKey:@"TestName"]] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
                            [alert show];
                            enterAlert=YES;
                            [alert release];

                        }
                        else
                        {
                            Custom_Alert *alert=[[Custom_Alert alloc] initWithTitle:@"Alert" message:[NSString stringWithFormat:@"The Value you entered is %@ outside the acceptable range.Please correct and Continue",[[healthyHeartFieldsAry objectAtIndex:getHHTag] objectForKey:@"TestName"]] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
                            [alert show];
                            enterAlert=YES;
                            [alert release];

                        }

                    }


                }

If i use this code. it is accepting the 400.5. pls help me to solve this issue.

  • 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-10T19:33:51+00:00Added an answer on June 10, 2026 at 7:33 pm

    You need to convert the NSString returned by your text field to an NSNumber:

    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
    [formatter setNumberStyle:NSNumberFormatterDecimalStyle];
    NSNumber *textFieldNumber = [formatter numberFromString:[textField text]];
    

    Then use

    [textFieldNumber decimalValue] > 100.0 && [textFieldNumber decimalValue] < 400
    

    to check the range.

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

Sidebar

Related Questions

I have this WPF slider: <Slider Height=22 HorizontalAlignment=Left Width=100 TickPlacement=BottomRight AutoToolTipPlacement=BottomRight TickFrequency=1 Minimum=10 Maximum=110
I have a slider with minimum value 0 and maximum value 1 . When
I have a minimum of 12 positions. The min and max values are 0
Brief Idea about the flow : I have say minimum 1 and maximum 18
I have some code that currently checks for minimum and maximum lentgh. I want
I cant get around on how to express this is PHP. I have 100
I have a map and I want to find the minimum value (right-hand side)
How would one go about finding the minimum value in an array of 100
I have a table that contains the following: DataDate Value 2010-03-01 08:31:32.000 100 2010-03-01
I have a list of 100 values (might scale in the future) that I

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.