WFFM MVC add javascript onclick when Submit

373 Views Asked by At

I'm currently trying to trigger dataLayer push events on submit for wffm mvc form. There are a couple of sources I've found and none of them has worked so far for MVC. The closest to what I could work with is combining what I've gathered with these two links Sitecore WFFM: act on success and Trigger Google Analytics Events on Sitecore Web Forms

Currently, I'm stuck on trying to output the form's success message since wffm mvc does not have Form.SuccessMessage(or as far as I know).

For webforms it's like this:args.Result = args.Form.SuccessMessage + script;

Any help would be much appreciated.

1

There are 1 best solutions below

0
Ahmet Çolak On

datalayer where trigger on html element push using javascript. for example: Your html element on show ,you want to push datalayer.

   $('#loading').on('shown.bs.modal', function () {
    dataLayer.push({ event: 'modalShowSuccessGoogleTy' });
});

ı hope this example can be helped you.