Skip to content

Commit

Permalink
Merge pull request #2 from yiisoft/master
Browse files Browse the repository at this point in the history
Fix yiisoft#13105: Add yiiActiveForm validate_only property for skipping for…
  • Loading branch information
sakibguy committed Nov 29, 2021
2 parents a4a88b4 + 17aa0e4 commit 618b78a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Yii Framework 2 Change Log
2.0.44 under development
------------------------

- Enh #13105: Add yiiActiveForm validate_only property for skipping form auto-submission (ptolomaues)
- Enh #18967: Use proper attribute names for tabular data in `yii\widgets\ActiveField::addAriaAttributes()` (AnkIF)
- Bug #18798: Fix `StringHelper::dirname()` when passing string with a trailing slash (perlexed)
- Enh #18328: Raise warning when trying to register a file after `View::endPage()` has been called (perlexed)
Expand Down
15 changes: 9 additions & 6 deletions framework/assets/yii.activeForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@
attributes: attributes,
submitting: false,
validated: false,
validate_only: false, // validate without auto submitting
options: getFormOptions($form)
});

Expand Down Expand Up @@ -754,12 +755,14 @@
data.submitting = false;
} else {
data.validated = true;
if (data.submitObject) {
applyButtonOptions($form, data.submitObject);
}
$form.submit();
if (data.submitObject) {
restoreButtonOptions($form);
if (!data.validate_only) {
if (data.submitObject) {
applyButtonOptions($form, data.submitObject);
}
$form.submit();
if (data.submitObject) {
restoreButtonOptions($form);
}
}
}
} else {
Expand Down

0 comments on commit 618b78a

Please sign in to comment.