Jump to content
Дизайн и модификация IPS Community IPBSkinsBETA
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  

Как добавить атрибут onsubmit в конструктор форм?

Recommended Posts



При попытке сохранить в шаблоне такой код, система ругается, что PHP не валидный.


{{$form = new \IPS\Helpers\Form( 'my_form', NULL, 'https://sendurl.com/');}}
{{$form->attributes['data-role'] = 'advancedSearch';}}
{{$form->attributes['onsubmit'] = 'ym(51358631, 'reachGoal', 'newSearchByFilter'); gtag('event', 'newSearchByFilter', {'event_category': 'form', 'event_action': 'newSearchByFilter'});VK.Retargeting.Event('newSearchByFilter'); return true;';}}


Ругается на последнюю строку. Скорее всего на знаки ";" и "'", но не пойму как строку подготовить для вставки.

Share this post

Link to post

Используйте двойные кавычки

{{$form->attributes['onsubmit'] = "ym(51358631, 'reachGoal', 'newSearchByFilter'); gtag('event', 'newSearchByFilter', {'event_category': 'form', 'event_action': 'newSearchByFilter'});VK.Retargeting.Event('newSearchByFilter'); return true;";}}

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...