Difference between #3 and #4 of
How to implement form events

Revision #4 has been created by Antonio Ramirez on Nov 3, 2014, 11:17:27 AM with the memo:

Changed API
« previous (#3) next (#9) »

Changes

Title unchanged

How to implement form events

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

yii2, forms, how to

Content changed

[...]
```php
<?php
$js = <<<JS
// get the form id and set the event
$('form#{$model->formName()}').on('beforeSubmit', function(e
, \$form) {) {
 
   var \$form = $(this);

// do whatever here, see the parameter \$form?
// is a jQuery Element to your form
}).on('submit', function(e){
e.preventDefault();
});
[...]
5 0
6 followers
Viewed: 37 970 times
Version: 2.0
Category: How-tos
Tags: Forms, How to, yii2
Written by: Antonio Ramirez
Last updated by: deacs
Created on: Sep 12, 2014
Last updated: 8 years ago
Update Article

Revisions

View all history