SeemGen/Components/Layout/MainLayout.razor

54 lines
1.3 KiB
Plaintext

@using BLAIzor.Services
@inherits LayoutComponentBase
@Body
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
@* <script>
window.getDivContent = (id) => {
let element = document.getElementById(id);
return element ? element.innerHTML : null;
};
</script> *@
<script>
window.getDivContent = (id) => {
const element = document.getElementById(id);
if (!element) return null;
// Get the HTML content of the div
const innerHtml = element.innerHTML;
// Collect all form inputs inside the div
const inputs = element.querySelectorAll('input, textarea, select');
const formData = {};
inputs.forEach(input => {
if (input.type === 'checkbox') {
formData[input.name || input.id] = input.checked;
} else if (input.type === 'radio') {
if (input.checked) {
formData[input.name || input.id] = input.value;
}
} else {
formData[input.name || input.id] = input.value;
}
});
return {
html: innerHtml,
values: formData
};
};
</script>
@code{
}