Skip to content

Commit ff3de30

Browse files
committed
Scrolls into view
1 parent 5f0e56f commit ff3de30

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

resources/js/Pages/Resources/Create.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ const submitForm = () => {
7070
toast.add({
7171
severity: "error",
7272
summary: "Error",
73-
detail: errors ? Object.values(errors).flat().join(' ') : "An error occurred while creating the resource.",
73+
detail: errors
74+
? Object.values(errors).flat().join("\n")
75+
: "An error occurred while creating the resource.",
7476
life: 10000,
7577
});
7678
},
@@ -81,6 +83,16 @@ const handleFormChange = (newFormData) => {
8183
Object.keys(newFormData).forEach((key) => {
8284
formData[key] = newFormData[key];
8385
});
86+
const htmlForm = document.getElementById("create-resource-form");
87+
if (htmlForm) {
88+
htmlForm.scrollIntoView({
89+
behavior: "smooth",
90+
block: "start",
91+
inline: "nearest",
92+
});
93+
// Also scroll the window to the top for full reliability
94+
window.scrollTo({ top: 0, behavior: "smooth" });
95+
}
8496
};
8597
</script>
8698

@@ -212,6 +224,7 @@ const handleFormChange = (newFormData) => {
212224
<!-- Main Form Section -->
213225
<div
214226
class="bg-white h-min shadow-lg rounded-lg p-6 flex-1 max-w-full md:max-w-3xl min-w-0 md:min-w-[28rem] relative"
227+
id="create-resource-form"
215228
>
216229
<!-- Move Reset button to top right -->
217230
<div class="flex justify-end mb-2">

0 commit comments

Comments
 (0)