Tuesday, 15 September 2015

javascript - Form submit button event is not captured when keyboard is up iOS 7 -



javascript - Form submit button event is not captured when keyboard is up iOS 7 -

i'm building web app using cordova targeting ios. have form

<form id="formid"> <div class="row"> <input type="text" name="something1" placeholder="something1" class="form-control" required maxlength="26" /> </div> <div class="row"> <input type="text" name="something2" placeholder="something2" class="form-control" pattern=".{6,6}" required /> </div> <div class="row"> <input type="submit" value="submit" class="button btn-primary" /> </div> </form>

in javascript have listener submit event.

my problem when keyboard showing in ios, clicking submit buttons doesn't trigger submit event. somethimes works first 2 times stops working. has run in before?

as may need first click "done" on keyboard (making disappear) , utilize submit button. or, click submit button keyboard showing create keybpoard hide , click submit again.

any ideas?

edit

it works fine on ios 6, on ios 7 submit button doesn't trigger event after first 2 clicks.

so solved problem having. stated in question worked fine ios6 , android. ios7 noticed when increased height of text fields above submit button got bug described above. when didn't add together non-default styling effected height of elements above submit button worked. weird right.

but read question.

so instead of having submit button , having script wait submit event fire, changed button link , listened touchend event. bam, worked charm.

$(document).on('touchend', 'form #button', function (e) { $('#formid').submit(); });

so allow event bypass , trigger submit event clicking "go" button on keyboard still trigger submit function.

javascript ios cordova

No comments:

Post a Comment