Система управления «Сайт PRO»
Версия 20240107

display.form.php

Форма ввода данных

Вызывается из:

Исходный код
<?php

$attributes = array();
if (isset($action)) {
    $attributes['action'] = $action;
} else {
    $attributes['action'] = $_SERVER['REQUEST_URI'];
}
if (isset($method)) {
    $attributes['method'] = $method;
} else {
    $attributes['method'] = 'POST';
}
if (isset($enctype)) {
    $attributes['enctype'] = $enctype;
} else {
    $attributes['enctype'] = 'multipart/form-data';
}
if (isset($autocomplete)) {
    $attributes['autocomplete'] = $autocomplete;
}
if (isset($novalidate)) {
    $attributes['novalidate'] = $novalidate !== false ? $novalidate : null;
}
if (isset($id)) {
    $attributes['id'] = $id;
} else {
    $attributes['id'] = 'form';
}
if (isset($onsubmit)) {
    $attributes['onsubmit'] = $onsubmit;
}

print "\n";
print '<form';
foreach ($attributes as $attributeName => $attributeValue) if ($attributeValue !== null) print ' ' . $attributeName . '="' . htmlspecialchars(is_scalar($attributeValue) ? strval($attributeValue) : json_encode($attributeValue)) . '"';
print '>';
print "\n";
print $html;
print "\n";
print '</form>';
print "
<script>
cmsRequire(['plugins/jquery.validate'], validate => validate(document.getElementById(" . json_encode($attributes['id']) . ")));
</script>
";

?>