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

Alternative to fobi_initial_data to provide initial values? #181

Open
will-emmerson opened this issue May 1, 2018 · 4 comments
Open

Alternative to fobi_initial_data to provide initial values? #181

will-emmerson opened this issue May 1, 2018 · 4 comments

Comments

@will-emmerson
Copy link

I need to be able to edit form submissions (I am using customized DBStoreHandlerPlugin), i.e. when viewing a form entry it needs to pick up previously entered data.
I could theoretically do this by passing initial values to view_form_entry using fobi_initial_data but this isn't going to work for longer forms with text fields because of url length limit.
Any advice on how I can do this without writing my own view?
I'm guessing this might be a bit easier when class-based views are finished?

@barseghyanartur
Copy link
Owner

@will-emmerson:

If you're not in hurry, wait until the CBVs are finished.

@jstacoder
Copy link

That functionality works awesomely, the way we are doing it, (so users don’t see any crazy url for the initial data) Is when they click the button to edit the form data the url is constructed in JavaScript from a python dict passed into the view, then the JavaScript opens that url in an iframe (fancybox) to display the form data to edit, then no one sees weird urls.

@barseghyanartur
Copy link
Owner

I'm thinking that when we have CBV ready, we could add alternative CBV views for viewing/submitting form in the db_store package, so that we could use those (over the default ones) if such functionality is needed).

@jstacoder
Copy link

@barseghyanartur actually we did need to override how that was happeing, and using the cbvs we just had to redefine get_initial_data and it just worked, we have the data in our own model, which we pass an id to the view, so our get_initial_data is just: return DataModel.objects.get(id=self.kwargs.get('id')).data

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

No branches or pull requests

3 participants