automatically move the focus of next text field if the length of the text field is equal to max range
<p>hi i have to text fields i want to move the focus from first text field to another textfield automatically  </p>

<p>for this i am using the following code </p>

<pre><code>- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
    BOOL isValid = YES;

    NSInteger insertDelta = string.length - range.length;   
    if (textField.tag == 0) {
            if (textField.text.length + insertDelta &gt;= 8)
        {
            [txtRxStoreNumber becomeFirstResponder];
            if (txtRxStoreNumber.text.length &gt;= 5) {
                isValid = NO;
            }
        } 

    }else if (textField.tag == 1) {
        if (textField.text.length + insertDelta &gt; 5)
        {
            isValid = NO;
        }   
        else if(textField.text.length + insertDelta == 0) {
            textField.text = @"";
            [txtRxItemNumber becomeFirstResponder];
            isValid = NO;
        }
    }

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

<p>the first textfield max range is 7 .</p>

<p>it is working but the problem is after entering the 8th character only the cursor focus moving to second text field.</p>

<p>if only 7 characters are entered the focus of cursor is in first text field only.</p>

<p>after entering the 7th character i want to move to focus of cursor to second text field .</p>

<p>can any one please help me how to do that.</p>
