Closed githubtobi closed 4 years ago
Hi @githubtobi ,
I think this is the wrong repo for this issue. But let me answer your question First, you need to add an ID to your modular section and change the "action" to your form to:
form: action: /your-page#yoursectioncontactform
to change the success message you need to add 'message' in the process action to your form
example:
form process: captcha: true save: fileprefix: contact- dateformat: Ymd-His-u extension: txt body: "{% include 'forms/data.txt.twig' %}" email: subject: "[Site Contact Form] {{ form.value.name|e }}" body: "{% include 'forms/data.html.twig' %}" message: Your custom thank you message.
If you want to float your success message, just use position: fixed;
instead of absolute and target that class to your css file.
@githubtobi example form here: https://learn.getgrav.org/16/forms/forms/example-form
form: action: /your-page#yoursectioncontactform
work like a charm - thanks!
Hi there,
is there a possibility to scroll down to the specific anker tag where the contact form at a modular page is nested (www.domain.com/en/start#contactform) or to setup a URL redirect after the form was submitted?
Background: When the contact form is nested at the very bottom of a modular page and the user presses the "submit" button, the page will reload but not scroll down to the contact form. So the user can not see the "message was delivered successul" message.
Some Testing (with modular pages): "display: /start/contact_form" - not working "page not found" "display: /start/contact_form/thankyou" - Created a "thank you" page under the "contact_form" modular page. This is working & the thankyou page is shown. But this is not what I am trying to solve. This could be a workaround for the beginning.
Another idea: is it possible to change the css to display the "message was delivered successul" message with css style "position: absolute; top: 10px; z-index:1000" so it will be visible at the very top after reloading. the "success" div doesn't come with any class or id so I can't reference to it.