Incorrectly Triggered As onsubmit onclick how to change?


<form onsubmit="yaCounter54702787.reachGoal('zayavka'); return false;" id="form5" class="text-center" method="post" action="">

When you press send without data validation works fine, does not miss. But in the metric comes that goal triggered the form submit and that the form is submitted.

How to make the onsubmit was working normal, only when you do the send but not when you press the button just.
April 3rd 20 at 17:31
2 answers
April 3rd 20 at 17:33
the problem was that there was a rule onclick on the button, it worked (on the call button modal. window)

and ordinary required is working fine, the goal is not conceded with blank data
April 3rd 20 at 17:35
Use a flag that will return a validation success/error form filling.
onsubmit="isValid ? yandex.push('yeah') : alert('ouch'); return false;"


Find more questions by tags CSSJavaScriptYandex.Metrica