Dynamic Form Data Not Saving: Event Schedule Information Vanishing on Submit

I’m having trouble with my Django app. I made a form that lets users add event dates and times. It looks good and works fine in the admin area. But when people use it on the website, the info they put in doesn’t save.

I’m using Alpine.js to make the form dynamic so users can add multiple dates and times. Even though the form displays correctly, when they hit submit, none of the data persists.

I’ve gone through my models, views, and forms, and everything appears to be set up correctly. However, something goes wrong between the submission and the actual saving of the data.

Has anyone experienced this issue before or have any suggestions on how to resolve it? I’m really stuck and could use some help figuring out why the dynamic form data isn’t being saved after submission.

I’ve encountered a similar issue in one of my projects. The problem might be in how the dynamic form data is being handled on submission. Have you checked if the data is correctly serialized before being sent to the server? With Alpine.js, sometimes the dynamic fields aren’t properly included in the form data when submitted.

One solution that worked for me was to manually collect all the dynamic field values using JavaScript just before form submission. Then, I added these values to a hidden input field as a JSON string. On the server side, I parsed this JSON data in the view and saved it accordingly.

Also, make sure your view is properly configured to handle the dynamic nature of the form data. You might need to adjust your form processing logic to account for the variable number of date and time inputs. It’s worth double-checking your CSRF protection as well, as sometimes that can interfere with dynamic form submissions.

ooh, interesting problem! have u tried using the browser’s dev tools to see what’s actually being sent to the server? sometimes the issue is in the data format. also, maybe try serializing the form data manually before sending? could be a timing issue with alpine.js. what happens if u log the data right before submission?

hey, had this problem before. check ur javascript. maybe the data isn’t being sent right. try console.logging the form data before it’s sent. also, make sure ur view can handle multiple dates/times. might need to tweak how u process the data on the server side. good luck!