Comparing
#9 with
#10
Revision #10 was created by deacs on Dec 2, 2015, 3:01:05 PM.
Added a little extra info
« Previous (#9)
Content
[...]
JS;
$this->registerJs($js);
```
When using `return false` to prevent submission, there is no need to use ` e.preventDefault()` on the `submit` event:
```php
<?php
$js = <<<JS
// get the form id and set the event
$('form#{$model->formName()}').on('beforeSubmit', function(e) {
// return false to prevent submission
return false;
}).on('submit', function(e){ // can be omitted
e.preventDefault(); // can be omitted
});
JS;
$this->registerJs($js);
```
> [](http://www.2amigos.us)
<i>web development has never been so fun</i>
[www.2amigos.us](http://www.2amigos.us)