Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not submit fields that not exists anymore #2312

Merged

Conversation

Koc
Copy link
Collaborator

@Koc Koc commented Sep 7, 2024

This pr aims to fix next bug. Here a reproducer:

  1. Create form with 2 questions
  2. Start filling the form but don't submit it
  3. Edit form and remove 1st question

Expected result: form successfully submitted

Actual result: there is an error on BE side

Copy link
Collaborator

@Chartman123 Chartman123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch :)

However, with your changes the values for Dropdown, Date and Time questions aren't loaded anymore. Other than that some small comments/improvements to the code.

Instead of doing it when loading from LocalStorage we could also check it on submission and remove answers for invalid questions there. What do you think?

src/views/Submit.vue Outdated Show resolved Hide resolved
src/views/Submit.vue Outdated Show resolved Hide resolved
@Chartman123 Chartman123 added bug Something isn't working javascript Javascript related ticket 3. to review Waiting for reviews feature: 📝 submitting responses labels Sep 8, 2024
@Chartman123 Chartman123 added this to the 4.3 milestone Sep 8, 2024
@susnux
Copy link
Collaborator

susnux commented Sep 8, 2024

Maybe rather show a warning like: "Warning the form has changed since you last visit, do you want to restart?"
As also already filled questions might have changed the wording or similar. But also maybe something to track in an issue

@Koc Koc force-pushed the bugfix/fix-submit-not-existent-fields branch 2 times, most recently from 541a39d to 0478938 Compare September 9, 2024 22:50
@Koc Koc force-pushed the bugfix/fix-submit-not-existent-fields branch from 0478938 to e4779f7 Compare September 9, 2024 22:55
@Koc
Copy link
Collaborator Author

Koc commented Sep 9, 2024

@Chartman123 thanx for suggestion, I've changed approach

image

@susnux yeah, we can, but let's fix issue first. BTW what component can I use for raising this warning?

@Chartman123
Copy link
Collaborator

@Koc I'll have a look at it and test it this evening :)

Copy link
Collaborator

@Chartman123 Chartman123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, works much better now. Just one small question :)

src/views/Submit.vue Show resolved Hide resolved
@Chartman123
Copy link
Collaborator

what component can I use for raising this warning?

You should use NcDialog like the two existing ones in Submit.vue :)

@Chartman123 Chartman123 self-requested a review September 10, 2024 18:34
Chartman123
Chartman123 previously approved these changes Sep 10, 2024
@Chartman123 Chartman123 dismissed their stale review September 10, 2024 18:35

Clicked wrong button

@Chartman123 Chartman123 self-requested a review September 10, 2024 18:35
@Chartman123 Chartman123 merged commit 70198c4 into nextcloud:main Sep 11, 2024
42 checks passed
@Koc Koc deleted the bugfix/fix-submit-not-existent-fields branch September 11, 2024 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug Something isn't working feature: 📝 submitting responses javascript Javascript related ticket
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants