$arDataSelectOptions = [
1 => 'data-select-options="5,6,7,8,9,10"',
5 => 'data-select-options="3,5,7"',
10 => 'data-select-options="8,9,10"',
...
'default' => 'data-select-options="1,2,3,4,5,6,7,8,9,10"'
];
if($g['id'] == "1") { $usd = 'data-select-options="5,6,7,8,9,10"'; } else { $usd = 'data-select-options="1,2,3,4,5,6,7,8,9,10"'; }
if(isset($arDataSelectOptions[intval($g['id'])]))
$usd = $arDataSelectOptions[intval($g['id'])];
else
$usd = $arDataSelectOptions['default'];
function validateForm() {
// This function deals with validation of the form fields
var x, y, i, valid = true;
x = document.getElementsByClassName("tab");
y = x[currentTab].getElementsByTagName("input");
// A loop that checks every input field in the current tab:
for (i = 0; i < y.length; i++) {
// If a field is empty...
if (y[i].value == "") {
// add an "invalid" class to the field:
y[i].className += " invalid";
// and set the current valid status to false
valid = false;
}
}
y = x[currentTab].querySelectorAll('input[type="radio"]');
if (y.length > 0) {
var checked = false;
for (i = 0; i < y.length; i++) {
if (y[i].checked) {
checked = true;
break;
}
}
if (!checked) {
/*
здесь добавть код, который применит
класс "invalid" для контейнера с radio-элементами
*/
valid = false;
}
}
// If the valid status is true, mark the step as finished and valid:
if (valid) {
document.getElementsByClassName("step")[currentTab].className += " finish";
}
return valid; // return the valid status
}