Hi,
I'm trying to add this onclick attribute to the submit button of a form:
onclick="return gtag_report_conversion('
example.com/your-link
')"
I tried 2 different methods but they all create bugs in the form:
METHOD 1: Creating custom Submit button (as indicated in this thread
bit.ly/3yCeUS5
)
Bug: The onclick attribute is not being added and the form is not being submitted.
Code:
function ff_SUBMITCUSTOM_action(element, action)
{
switch (action) {
case 'click':
onclick="return gtag_report_conversion('
example.com/your-link
')"
break;
default:;
} // switch
} // ff_SUBMITCUSTOM_action
ff_validate_submit();
METHOD 2: Adding a custom initialization script (
bit.ly/3lQFkMt
)
BUG: The form is being submitted but not being validated and nothing is being sent to the mailback email or being received in the admin email
CODE:
function ff_FreeAuditRequest_breezy_EN_init()
{
jQuery('#bfSubmitButton').attr('onclick', "gtag_report_conversion('
example.com/your-link
');" + jQuery('#bfSubmitButton').attr('onclick'));
} // ff_FreeAuditRequest_breezy_EN_init
Of course instead of
example.com/your-link
i put my link. This is just to show the code example.
Any suggestions on what might be going on?
Thanks.