Rama Rao
Rama Rao

Reputation: 1033

To show keypad automatically to next input text on webview in iphone

Before keypad shift to next input after calling focus() or select() keypad disappears.

Can anyone please help me by solving problem in my application.I have three input tags of type text and I need to shift the cursor point from one input tag to other.I used focus() but not working.keypad is dismissing.I need to show the keypad automatically after shifted to second or third input tags.

<span style="font-size:25px;
                ">(</span><input type="tel" value="" id="mobile_num1" name="mobile_num1" placeholder="Mobile Phone Number" alt="" title="Mobile Phone Number"  class="input-box_one-phone" maxlength=3 onkeypress="return checknum(this)" /><span style="font-size:25px;
                    ">)&nbsp;</span><input type="tel" value="" id="mobile_num2" name="mobile_num2" placeholder="Mobile Phone Number" alt="" title="Mobile Phone Number"  class="input-box_one-phone" onkeypress="return checknum(this)" maxlength=3/><span style="font-size:25px;
                    "  >&nbsp;-&nbsp;</span><input type="tel" value="" id="mobile_num3" name="mobile_num3" placeholder="Mobile Phone Number" alt="" title="Mobile Phone Number"  class="input-box_one-phone"  maxlength=4 />
<script>
function checknum(currObj){


        if(window.event.keyCode != 8 ){
            if(window.event.keyCode > 48 && window.event.keyCode < 59) {

                if(currObj.value.length == 3){
                    var dd =    $(currObj).next();
                    if($(dd).html()){
                        dd = $(dd).next();
                    }
                    $(dd).val(String.fromCharCode(window.event.keyCode));
                    $(dd).focus();
                    return false;

                }


            }
        }    
            return true;

    }
</script>

Upvotes: 1

Views: 715

Answers (2)

Rama Rao
Rama Rao

Reputation: 1033

This is not possible using webview.We should take the custom viewController integrated class and design it and code it.

Upvotes: 1

The iOSDev
The iOSDev

Reputation: 5267

i have tried in an application of xcode


- (IBAction)textFieldDone:(id)sender {
UITableViewCell *cell =
(UITableViewCell *)[[sender superview] superview];
UITableView *table = (UITableView *)[cell superview];
NSIndexPath *textFieldIndexPath = [table indexPathForCell:cell];
NSUInteger row = [textFieldIndexPath row];
row++;
if (row >= kNumberOfEditableRows) {
    row = 0;
}
NSIndexPath *newPath = [NSIndexPath indexPathForRow:row inSection:0];
UITableViewCell *nextCell = [self.tableView
                             cellForRowAtIndexPath:newPath];
UITextField *nextField = nil;
for (UIView *oneView in nextCell.contentView.subviews) {
    if ([oneView isMemberOfClass:[UITextField class]])
        nextField = (UITextField *)oneView;
}
[nextField becomeFirstResponder];

}


in this i have one view and in that view have to edit 4 text fiels and on tapping on return key of key board the all text fields are selected in continuation one after another.

i think this will help you

Upvotes: 1

Related Questions