diff --git a/index.html b/index.html
index 3ce6327..5fa88f1 100644
--- a/index.html
+++ b/index.html
@@ -652,27 +652,28 @@ SELECT * FROM users LIMIT 10;">
}
async generateRecordForm() {
- if (response.status === 401) {
- this.logout();
- return [];
- }
const columns = await this.getTableStructure(this.currentTable);
const container = document.getElementById('recordForm');
+ if (!columns || columns.length === 0) {
+ container.innerHTML = `
Не удалось загрузить структуру таблицы
`;
+ return;
+ }
+
container.innerHTML = columns.map(col => `
-
-
-
-
${col.type}
-
- `).join('');
-}
+
+
+
+
${col.type}
+
+ `).join('');
+ }
async getTableStructure(tableName) {
try {
@@ -706,7 +707,11 @@ SELECT * FROM users LIMIT 10;">
const inputs = form.querySelectorAll('input');
const data = {};
inputs.forEach(input => {
- if (input.type === 'number') {
+ if (input.name === 'id') return;
+
+ if (input.type === 'checkbox') {
+ data[input.name] = input.checked;
+ } else if (input.type === 'number') {
data[input.name] = parseFloat(input.value);
} else {
data[input.name] = input.value;