V
V
Vitaly Max2019-05-12 12:22:11
JavaScript
Vitaly Max, 2019-05-12 12:22:11

Why is the goal in the metric triggered when an empty form is submitted?

Hello!
I set the goal in the metric for sending the application, wrote the code in the form tag

<form action="mail/smart.php" method="POST" id="feedback-form" onsubmit="yaCounter53521924.reachGoal ('ask'); return true;">

The form has validation set so that empty fields cannot be submitted, but the goal in the metric works even with empty fields. In fact, nothing was sent to the server, but the target worked.. how to defeat this phenomenon? What piece of code and where do you want to add it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Syomka Gavrilenko, 2019-05-12
@cema93

The matter is that onsubmit works when the user presses the submit button of the form. regardless of whether it was sent or you somehow canceled the sending

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question