Good day! There is the following form code:

<? echo $warnText ? "<div class='warnText'>$warnText</div>" : NULL; $res = $db->get_var("SELECT CustomSettings FROM Sub_Class WHERE Sub_Class_ID=$cc"); ( $res ? eval("\$cc_settings = $res") : $cc_settings = NULL ); $res = $db->get_var("SELECT CustomSettingsTemplate FROM Class WHERE Class_ID=$classID"); eval("\$default_cc_settings = $res"); if (!$inside_admin) { ?> <p /> <? echo ( $cc_settings['TextBefore'] ? $cc_settings['TextBefore'] : $default_cc_settings[TextBefore][default_value] ); ?> <style type='text/css'> div.textarea { width: 100%; } </style> <div class='nc_full nc_mail_from_site'> <form name='adminForm' onsubmit="yaCounter12924709.reachGoal('ORDER-CONTACTS'); return true;" method='post' action='<? echo $SUB_FOLDER.$HTTP_ROOT_PATH ?>add.php'> <? $nc_core->token->get_input() ?> <input name='cc' type='hidden' value='<? echo $cc ?>'> <input name='sub' type='hidden' value='<? echo $sub ?>'> <input name='catalogue' type='hidden' value='<? echo $catalogue ?>'> <input type='hidden' name='posting' value='1'> <div class='nc_item'> <?= nc_string_field("Name", "maxlength='55' size='10'", $classID, 1); ?> </div> <br /> <div class='nc_item'> <?= nc_string_field("Phone", "maxlength='55' size='10'", $classID, 1); ?> </div> <br /> <div class='nc_item'> <?= nc_string_field("Email", "maxlength='55' size='10'", $classID, 1); ?> </div> <br /> <div class='nc_item'> <?= nc_string_field("Subject", "maxlength='55' size='10'", $classID, 1); ?> </div> <br /> <div class='nc_item'> <?= nc_text_field("Text", "style='width: 100%;'", $classID, 1); ?> </div> <div class='nc_description'> Звездочкой (*) отмечены поля, обязательные для заполнения. </div> <br /> <div class='nc_submit'><input value='Отправить' type='submit' /></div> </form> </div> <? } ?> 

How to make the goal triggered when you click on the button only after the form has been successfully submitted and displayed in the Reach goal console?

    1 answer 1

    Hello! Most likely you are using Netcat as a CMS. You need to execute the Javascript code as a result of successful sending. That is, you will find out that sending is successful, according to the results of sending to the server, in the handler on onsubmit and after that you execute the Metrics code, you can edit the necessary data after successful sending here - Development / Components / Your form component / Action templates / Action after adding the object.

    • Can you write an exemplary implementation of this? I am not well-versed in this topic - Demon
    • To begin with, intercept all form submissions. The easiest way is through jQuery: gist.github.com/mitkinstas/e25ef1b18ec191ff249e1dcd7c0eb3a4 Well, the changes in the component in Netcat also need to be done so that in case of successful sending it will come success . - Stanislav
    • Stanislav this code does not work for my Reach goal form is not displayed in the console. What could be the reason? This code is specified in Development / Components / Your form component / Action templates / Action after adding an object. - Demon
    • The code I gave here is gist.github.com/mitkinstas/e25ef1b18ec191ff249e1dcd7c0eb3a4 An example of a form submission capture. Go to the forum of your CMS and learn about how to configure it there. - Stanislav