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

Forms should be submittable without JS #32

Open
JeffersonBledsoe opened this issue Sep 8, 2022 · 4 comments
Open

Forms should be submittable without JS #32

JeffersonBledsoe opened this issue Sep 8, 2022 · 4 comments

Comments

@JeffersonBledsoe
Copy link
Member

JeffersonBledsoe commented Sep 8, 2022

The current form relies on the onSubmit handler to submit to the backend. Adding an action with a URL of path + /@submit-form should allow these forms to work without JS (I haven't tested to see if the backend package will handle these form submissions yet, so some adjustments may need to be made to collective.volto.formsupport.

What we need

  • A normal form submission is made on the client
  • This form submission hits the Volto frontend
  • The form submission is routed to the corresponding API endpoint on the backend

Proposed solution

  • Catch the form submission in a volto middleware
  • Check the mimetype for a form submission
  • Convert it to JSON and submit to the 'normal' JSON endpoint.
  • Create a mapping object/ function to optionally convert form name keys into a different key in the JSON
  • Create a config to specify what the backend endpoint route should be
    • Could this be done with hidden inputs?
@alisedaghatbaf
Copy link

I get the following error when trying to submit a form. Let me know what I am missing here.
image

@JeffersonBledsoe
Copy link
Member Author

Hi @alisedaghatbaf. Have you got the collective.volto.formsupport addon installed in your site? volto-form-block (this package) provides the UI for form editing while collective.volto.formsupport provides the backend API endpoints for submitting forms, storing data, etc.

@alisedaghatbaf
Copy link

Hi @alisedaghatbaf. Have you got the collective.volto.formsupport addon installed in your site? volto-form-block (this package) provides the UI for form editing while collective.volto.formsupport provides the backend API endpoints for submitting forms, storing data, etc.

yes, have done that.

@tiberiuichim
Copy link
Member

@alisedaghatbaf In running Volto or Plone, go to the Control panel > Addons and enable the collective.volto.formsupport

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