<div data-type="my_inputs">
<input />
<input />
…
<input />
</div>
document.querySelector('[aria-inputs="my_inputs"] input').addEventListener('blur', function(){
this.target.classList.remove(…);
});
[].map.call(document.querySelectorAll('[data-type="my_inputs"] input'), function (_input) {
_input.addEventListener('focus', function (ev) {
…
});
_input.addEventListener('blur', function (ev) {
…
});
});
Users из вендора, связь описана только в моделях как hasOne
if (isset($name) && isset($email) && isset($subject) && isset($body)) { …
?if (isset($_POST['name'])) {
$name = trim($_POST['name']);
}
…
if (!empty($name) && !empty($email) && !empty($subject) && !empty($body)) {
…
return ($data->id == $accept[0] ? Html::a(Html::encode($orders[0] . ', '), ['order/view', 'id' => $orders[0]]) : '')
. ($data->id == $accept[1] ? Html::a(Html::encode($orders[1]), ['order/view', 'id' => $orders[1]]) : '');
var RGroup = (function () {
function RGroup() {
this.group = document.querySelectorAll('input[type="radio"]');
var _that = this;
[].map.call(this.group, function (_el) {
_el.addEventListener('change', _el['_change'] = function (ev) {
if (this.checked) {
this.hasCheck = true;
_that.leaveAll(this);
}
});
_el.addEventListener('click', _el['_click'] = function (ev) {
if (this.hasCheck) {
this.setAttribute('disabled', 'disabled');
_that.group.item(0).checked = true;
}
});
});
}
RGroup.prototype.leaveAll = function (current) {
[].map.call(this.group, function (_el) {
if (_el != current && _el.hasCheck) {
_el.hasCheck = false;
}
});
};
return RGroup;
}());
var rg = new RGroup();
class RGroup {
constructor() {
this.group = document.querySelectorAll('input[type="radio"]');
let _that = this;
[].map.call(this.group, function (_el) {
_el.addEventListener('change', _el['_change'] = function (ev) {
if (this.checked) {
this.hasCheck = true;
_that.leaveAll(this);
}
});
_el.addEventListener('click', _el['_click'] = function (ev) {
if (this.hasCheck) {
this.setAttribute('disabled', 'disabled');
_that.group.item(0).checked = true;
}
});
});
}
leaveAll(current) {
[].map.call(this.group, function (_el) {
if (_el != current && _el.hasCheck) {
_el.hasCheck = false;
}
});
}
}
let rg = new RGroup();