fsbraun / djangocms-form-builder

Other
11 stars 6 forks source link

no hardwired submit button #17

Open jamesmc opened 1 month ago

jamesmc commented 1 month ago

Is your feature request related to a problem? Please describe. The submit button is hardwired into the form template. More flexibility with how to submit forms would be good.

Describe the solution you'd like It should be possible to have different ways to trigger the submit event so that the form can do different things on submit. In particular, it would be nice to be able to navigate away from the form to a submission successful page or a second form page, etc after submit.

Describe alternatives you've considered I have come up with my own workaround. I have modified templates/djangocms_form_builder/ajax_form.html to add a click event listener to any anchor elements on the form that then triggers the forms submit event. This means that any djangocms_link plugin added to the form will trigger submit. I have also removed the hardwired submit input from templates/djangocms_form_builder/bootstrap5/form.html

Here is a snippet of my modified code for ajax_form.html:

`{% addtoblock 'js' %}{% endaddtoblock %}`