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

Use emit() to forward response data #63

Open
jrief opened this issue May 12, 2023 · 0 comments
Open

Use emit() to forward response data #63

jrief opened this issue May 12, 2023 · 0 comments

Comments

@jrief
Copy link
Owner

jrief commented May 12, 2023

I've created a search form where you the user can enter search criteria and when they hit submit, the search results would, ideally, appear below the form. I'm using FormCollectionView to create the form as the user can add multiple criteria forms before submitting. I'm using the form_collection_valid method to get the cleaned_data so I can perform the search on the database. But at this point I'm not sure how to return the results to the browser. This method can only return a success_url. Is there a way to return the results via Ajax, so the page doesn't reload? I can save the values to the database and my success_url have parameters to reference the saved data, but I would prefer to do this all in the same view, if possible, and not have to save the data if the user doesn't need it for later.

Originally posted by @anthonycalvano in #62

@jrief jrief changed the title I've created a search form where you the user can enter search criteria and when they hit submit, the search results would, ideally, appear below the form. I'm using FormCollectionView to create the form as the user can add multiple criteria forms before submitting. I'm using the form_collection_valid method to get the cleaned_data so I can perform the search on the database. But at this point I'm not sure how to return the results to the browser. This method can only return a success_url. Is there a way to return the results via Ajax, so the page doesn't reload? I can save the values to the database and my success_url have parameters to reference the saved data, but I would prefer to do this all in the same view, if possible, and not have to save the data if the user doesn't need it for later. Use emit() to forward response data May 12, 2023
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

1 participant