Help with Weird Text Validation Issue on iPHone App
<p>I am using two forms of text validation (one when they click Next, another when they manually select the next text field to enter) and it's been working perfect. However, the last text field isn't getting error checked and I can't figure it out.</p>

<p>You can see the issue in this video on the last text field (http://screencast.com/t/ODJiOTAwMzA). The previous four work fine as you can see, but the bottom not so much.</p>

<p>Here is my code:</p>

<pre><code>- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    if (textField == txtUserName)
    {
        NSString *userNameOne = txtUserName.text;
        double numOne = [userNameOne doubleValue];  

        if(numOne &lt; 30 || numOne &gt; 80)
        {

            //foo

            [txtUserName becomeFirstResponder];
            txtUserName.text = nil;
        }
        else 
        {
            [txtUserName2 becomeFirstResponder];
        }
    }

    else if (textField == txtUserName2)
    {

        NSString *userNameThree = txtUserName2.text;
        float numTwo = [userNameThree doubleValue]; 

        if (numTwo &lt; 20 || numTwo &gt; 32)
        {
            //foo

            [txtUserName2 becomeFirstResponder];
            txtUserName2.text = nil;
        }
        else
        {
            [txtUserName3 becomeFirstResponder];
        }
    }
    else if (textField == txtUserName3)
    {
        NSString *userNameThree = txtUserName3.text;
        float numThree = [userNameThree doubleValue];

        if (numThree &lt; 475 || numThree &gt; 650)
        {
            //foo

            [txtUserName3 becomeFirstResponder];
            txtUserName3.text = nil;
        }
        else
        {
            [txtUserName4 becomeFirstResponder];

        }
    }
    else if (textField == txtUserName4)
    {
        NSString *userNameFour = txtUserName4.text; 
        double numFour = [userNameFour doubleValue];

        if (numFour &lt; 0.5 || numFour &gt; 3.00)
        {

                        //foo

            [txtUserName4 becomeFirstResponder];
            txtUserName4.text = nil;
        }
        else
        {
            [txtUserName5 becomeFirstResponder];
        }
    }

    else if (textField == txtUserName5)
    {
        NSString *userNameFive = txtUserName5.text;
        double numFive = [userNameFive doubleValue];

        if (numFive &gt; 1)
        {
                        //foo

        }
    }
    return NO;
}
</code></pre>

<p>and here</p>

<pre><code>if (textField == txtUserName)
    {
        NSString *userNameOne = txtUserName.text;
        double numOne = [userNameOne doubleValue];  

        if(numOne &lt; 30 || numOne &gt; 80)
        {

                        //foo

            [txtUserName becomeFirstResponder];
            txtUserName.text = nil;
        }
        else 
        {
            [txtUserName2 becomeFirstResponder];
        }
    }

    else if (textField == txtUserName2)
    {

        NSString *userNameThree = txtUserName2.text;
        float numTwo = [userNameThree doubleValue]; 

        if (numTwo &lt; 20 || numTwo &gt; 32)
        {

                        //foo

            [txtUserName2 becomeFirstResponder];
            txtUserName2.text = nil;
        }
        else
        {
            [txtUserName3 becomeFirstResponder];
        }
    }
    else if (textField == txtUserName3)
    {
        NSString *userNameThree = txtUserName3.text;
        float numThree = [userNameThree doubleValue];

        if (numThree &lt; 475 || numThree &gt; 650)
        {
            //fo

            [txtUserName3 becomeFirstResponder];
            txtUserName3.text = nil;
        }
        else
        {
            [txtUserName4 becomeFirstResponder];

        }
    }
    else if (textField == txtUserName4)
    {
        NSString *userNameFour = txtUserName4.text; 
        double numFour = [userNameFour doubleValue];

        if (numFour &lt; 0.5 || numFour &gt; 3.00)
        {

            //foo

            [txtUserName4 becomeFirstResponder];
            txtUserName4.text = nil;
        }
        else
        {
            [txtUserName5 becomeFirstResponder];
        }
    }
    else if (textField == txtUserName5)
    {
        NSString *userNameFive = txtUserName5.text;
        double numFive = [userNameFive doubleValue];

        if (numFive &gt; 1)
        {
            //foo
        }
        else
        {
            [txtUserName5 becomeFirstResponder];
        }
    }
</code></pre>
