Pobrałem formularz http://tympanus.net/codrops/2010/03/12/php...rm-with-jquery/wysyłania wiadomości email raz dopisania rekordu do bazy. Wszystko jest ok ale chcę wyeliminować wysyłanie wiadomości poprzez naciśnięcie enter. Z uwagi na to że javascript to temat zupełnie nie znany proszę o pomoc:
$(document).ready(function() { contact.initEventHandlers(); }); var contact = { initEventHandlers : function() { /* clicking the submit form */ $('#send').bind('click',function(event){ $('#loader').show(); setTimeout('contact.ContactFormSubmit()',500); }); /* remove messages when user wants to correct (focus on the input) */ $('.inplaceError',$('#ContactForm')).bind('focus',function(){ var $this = $(this); if($error_elem.length) }); /* user presses enter - submits form *//* $('#ContactForm input,#ContactForm textarea').keypress(function (e) { if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) { $("#send").click(); return false; } else return true; });*/ }, ContactFormSubmit : function() { $.ajax({ type : 'POST', dataType : 'json', success : function(data,textStatus){ //hide the ajax loader $('#loader').hide(); if(data.result == '1'){ //show success message //reset all form fields //envelope animation $('#envelope').stop().show().animate({'marginTop':'-175px','marginLeft':'-246px','width':'492px','height':'350px','opacity':'0'},function(){ $(this).css({'width':'246px','height':'175px','margin-left':'-123px','margin-top':'-88px','opacity':'1','display':'none'}); }); } else if(data.result == '-1'){ for(var i=0; i < data.errors.length; ++i ){ if(data.errors[i].value!='') } } }, error : function(data,textStatus){} }); } };
Wyłączyłem user press enter ale to nie pomogło.