javascript - Onsubmit doesn't work in Chrome -
i have 2 forms , button. works fine in firefox. new window, paypal payment, , in window happened send_mail form submitted send e-mail user. how can make work in chrome? why it's not working? i've tried (or think)!
so:
<form name="registerform" id="registerform" target="_blank" action="paypal_url" method="post" onsubmit="$('#send_mail').submit();"> ... </form> <form name="send_mail" id="send_mail" action="" method="post"> ... </form> <a onclick="$('#registerform').submit()">go paypal , send confirmation mail</a>
unless have reason use javascript-only submit, why set form unusable if there javascript error?
use standard form input of type submit, give id, alter or text of submit via javascript necessary, , create onclick & onsubmit events layer on top of functionality , have them return false. better fallbacks.
i'm not sure why you're trying submit 2 forms @ once, how alternative (note haven't tested code, should convey idea):
<script type='text/javascript'> $('#fallback-register-submit').hide(); // hide submit button. $('#registration-link').show().click(function (){ // show link , attach action. $('#registerform').submit(); return false; // don't bother following link anchor. }); </script> <form name="registerform" id="registerform" target="_blank" action="paypal_url" method="post""><!-- single form of submitting. --> ... ... <input type='submit' id='fallback-register-submit'>register</input><!-- in event of javascript error browser, can still buy stuff! --> <a id='registration-submit' style='display:none'>go paypal , send confirmation mail</a> </form>
Comments
Post a Comment