Fixes #15791: Added a warning when the form names conflict

This commit is contained in:
Rustam Mamadaminov
2018-09-24 20:45:42 +05:00
committed by Alexander Makarov
parent 9a3b3a759b
commit a953e7e423
2 changed files with 14 additions and 2 deletions

View File

@ -4,6 +4,7 @@ Yii Framework 2 Change Log
2.0.16 under development
------------------------
- Bug #15791: Added a warning when the form names conflict (s1lver, rustamwin)
- Enh #16151: `ActiveQuery::getTableNameAndAlias()` is now protected (s1lver)
- Bug #16657: Ensure widgets after run event result contains the result of the rendered widget (AdeAttwood)
- Bug #14230: Fixed `itemsOptions` ignored in `checkBoxList` (s1lver)

View File

@ -160,7 +160,18 @@ window.yii = (function ($) {
pjax = $e.data('pjax'),
usePjax = pjax !== undefined && pjax !== 0 && $.support.pjax,
pjaxContainer,
pjaxOptions = {};
pjaxOptions = {},
conflictParams = ['submit', 'reset', 'elements', 'length', 'name', 'acceptCharset',
'action', 'enctype', 'method', 'target'];
// Forms and their child elements should not use input names or ids that conflict with properties of a form,
// such as submit, length, or method.
$.each(conflictParams, function (index, param) {
if (areValidParams && params.hasOwnProperty(param)) {
console.error("Parameter name '" + param + "' conflicts with a same named form property. " +
"Please use another name.");
}
});
if (usePjax) {
pjaxContainer = $e.data('pjax-container');