boltforms icon indicating copy to clipboard operation
boltforms copied to clipboard

Feedback/success message is never triggered

Open eduardomart opened this issue 7 years ago • 15 comments

This used to work in BF 3.x but now the 'Feedback' never gets displayed. The form simply refreshes after a successful submission, no feedback at all.

Workaround:

In boltforms.form.yml add the redirect property under feedback, like so:

feedback:
   success: Message sent!  #<--- this is not working
   redirect:
      target: page/contact?success=true

In my case page/contact is the record that loads my contact form, so in its template I use the following code:

{% if app.request.get('success') == true %}
   <p>Message sent!</p>
{% else %}
   {{ boltforms('contact') }}
{% endif %}

That way the success message is only displayed when triggered by the success redirect.

eduardomart avatar Jul 28 '18 09:07 eduardomart

@eduardomart the boltforms templates are changed when going from 3.x to 4.x. One of these changes is that the messages are handled a bit differently.

You probably need to rebuild the form customization templates based on the new boltforms templates.

jadwigo avatar Jul 31 '18 08:07 jadwigo

@eduardomart did you get any further with this?

jadwigo avatar Aug 24 '18 11:08 jadwigo

I did manage to upgrade to boltforms ~~3.4~~ 4.x, however the issue remains, the success message is not triggered, the page just gets refreshed

eduardomart avatar Aug 24 '18 16:08 eduardomart

Same here

grafik

Largo avatar Dec 05 '18 11:12 Largo

**EDIT: Nevermind this doesn't work all the time. Only sometimes, even after I changed the template to be almost the same. Also the data array in the email lacks all but one formfield. I'll give up now and roll my formcode. **

Would be great if this was clearly documented along with the other things I spent 5 hours on today (for instance "choice: content"):

In your formfile replace: {{ form_start(form, {'attr': {'name': formname}}) }} with {{ form_start(form, form_start_param) }}

Largo avatar Dec 05 '18 11:12 Largo

@jadwigo, could you please elaborate on how to "rebuild the form customization templates based on the new boltforms templates"?

I am currently on BoltForms v4.2.5, but as mentioned, the page seems to be reloading in place of the feedback showing.

Edit: I tested a few versions of BoltForms, and this seems to be an issue starting at v4.2.4 as it's working in v4.2.3.

pragmaworking avatar Dec 17 '18 19:12 pragmaworking

@jadwigo, could you please elaborate on how to "rebuild the form customization templates based on the new boltforms templates"?

Sure.

If you have created custom templates for an older boltforms you need to start over fresh. So start by copying all templates from the boltforms extension to your theme. Set up the boltforms configuration to use the newly copied templates in your theme. Then recreate the customizations you had for the older version of boltforms to the newly copied templates.

Basically: make a copy of the new templates and do all your customizations again in the new templates.

jadwigo avatar Dec 19 '18 10:12 jadwigo

Thanks.

I ended up rolling back to v4.2.3 for a quick fix, but I'll keep the refreshed custom template approach in mind for the future.

pragmaworking avatar Dec 27 '18 20:12 pragmaworking

@jadwigo @pragmaworking I have the same issue: feedback never shown after success submission. I have checked all the differences in stock files in extensions/vendor/bolt/boltforms/templates/ between v.4.2.3 (last working version as mentioned by @pragmaworking, also working for me) and v.4.2.5 and found the only file and only difference in line 329 of extensions/vendor/bolt/boltforms/templates/form/_form_theme.twig. I transferred that difference into my customized template _form_theme.twig in theme folder (derived originally from v.4.2.3) and still have the same issue. Nothing changed.

So I believe minor templates change as suggested by @jadwigo is not the root cause.

[edit] Reverting back to 4.2.3, it looks the only solution right now

dutty5 avatar Dec 30 '18 09:12 dutty5

I confirm this. On v4.2.6 the bug is still present: no feedback after successfull submission.

https://github.com/bolt/boltforms/compare/v4.2.3...v4.2.6 - here you can see the difference between 4.2.3 and 4.2.6. As can be seen, the majority of changes only affect the docs. There are only minor changes in the source code, and they are the reason of the bug. V4.2.3 is the latest good-to-go version as of now.

P.S. I never used old templates, I started with v4.2.5 right away and the bug has already been there. So dear devs, please look into this. Thanks.

COOLak avatar Feb 11 '19 01:02 COOLak

I think I've found the problem that causes it. On file: src/Submission/Handler/Redirect.php, look up this code: " public function refresh(Request $request) { $response = new RedirectResponse($request->getRequestUri()); return $response->send(); } " Remove return part of the line so it will be only: $response->send();. Why? I dunno... It's very weird for me that returning the response would cause it to not send the success message...

SantinoPetrovic avatar Feb 21 '19 12:02 SantinoPetrovic

~~I can confirm on the latest master build the issue is gone.~~

Please disregard this. The master build is ancient. On the latest version, which is 4.2.6, the issue persists. 4.2.3 is still the latest version unaffected.

COOLak avatar Mar 20 '19 13:03 COOLak

I confirm that @SantinoPetrovic 's solution works (in v4.2.6). Thank you.

dutty5 avatar Apr 25 '19 18:04 dutty5

Also can confirm @SantinoPetrovic 's fix worked perfect for me too on v 4.2.6 Thank you so much, this was driving me crazy and spent about 2 hours before finding this fix.

simplecreatif avatar May 07 '19 07:05 simplecreatif

Should be fixed in 4.3.0-beta.1, but it's still experimental. It'd be helpful if some more people could try it out, to test it in the field.

See: #284

bobdenotter avatar May 16 '19 05:05 bobdenotter