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

[BUG] Edit form does not save form after initial save #16

Open
1 of 2 tasks
7er opened this issue May 5, 2020 · 6 comments
Open
1 of 2 tasks

[BUG] Edit form does not save form after initial save #16

7er opened this issue May 5, 2020 · 6 comments
Assignees
Labels

Comments

@7er
Copy link

7er commented May 5, 2020

Environment

Steps to Reproduce

  1. Clone react-starterkit repo
  2. npm install
  3. Configure PROJECT_URL to your project
  4. npm start
  5. Login with admin user
  6. Create a new form
  7. Edit form and add one field
  8. Save form
  9. Add another field
  10. Save form
  11. Reload page

Expected behavior

Both fields are still present after reloading page

Observed behavior

  1. Save form (the newly added field is not present in xhr call to server)
  2. Reload form and the newly added field is gone

Example

Before adding second field (after step 7.)

Skjermbilde 2020-05-05 kl  16 29 25

Add second field and save it (step 8 and 9)

UI and save response
Skjermbilde 2020-05-05 kl  16 34 43

UI and save request body
Skjermbilde 2020-05-05 kl  16 35 55

@7er 7er added the bug label May 5, 2020
@randallknutson
Copy link
Contributor

We've seen this issue from time to time and thought we had it fixed. The issue is that the connection with the scoped variable within the react app gets lost during the update process when react refreshes the props. This needs to be investigated again to see if something has broken again recently and how to fix it.

@7er
Copy link
Author

7er commented May 8, 2020

I've localized the bug to the implementation of FormEdit.getDerivedStateFromProps. When adding the second field/component to the form this function overwrites this.state.form with this.props.form.

@rahulseth625
Copy link

rahulseth625 commented Jan 27, 2021

@7er @randallknutson Can you pls see why am I getting this error
#17

@handhikadj
Copy link

handhikadj commented Mar 9, 2023

I'm getting this issue.
I notice on page loads, it triggers the onChange with empty values of the submission.data object

const onFormioChange = async (submission: any) => {
        const formData = new FormData();
        formData.append('form_values', JSON.stringify(submission.data))

        const updateFormValues = await fetch(`/form/update`, {
            method: 'POST',
            body: formData
        })
    }
    
    return <Form
        onChange={onFormioChange}
    />

this needs to be fixed ASAP!!!

@unnatijadhav
Copy link

can i check this?

@olgabann olgabann self-assigned this Jun 26, 2024
@lane-formio
Copy link
Contributor

lane-formio commented Jun 27, 2024

can i check this?

@unnatijadhav Absolutely, please do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants