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

Feedback/success message is never triggered #257

Open
eduardomart opened this issue Jul 28, 2018 · 15 comments
Open

Feedback/success message is never triggered #257

eduardomart opened this issue Jul 28, 2018 · 15 comments

Comments

@eduardomart
Copy link

eduardomart commented Jul 28, 2018

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 eduardomart changed the title 'Feedback' is never triggered Feedback/success message is never triggered Jul 28, 2018
@jadwigo
Copy link
Collaborator

jadwigo commented Jul 31, 2018

@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
Copy link
Collaborator

jadwigo commented Aug 24, 2018

@eduardomart did you get any further with this?

@eduardomart
Copy link
Author

eduardomart commented Aug 24, 2018

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

@Largo
Copy link

Largo commented Dec 5, 2018

Same here

grafik

@Largo
Copy link

Largo commented Dec 5, 2018

**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) }}

@pragmaworking
Copy link

pragmaworking commented Dec 17, 2018

@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.

@jadwigo
Copy link
Collaborator

jadwigo commented Dec 19, 2018

@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.

@pragmaworking
Copy link

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.

@dutty5
Copy link

dutty5 commented Dec 30, 2018

@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

@COOLak
Copy link

COOLak commented Feb 11, 2019

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

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.

@SantinoPetrovic
Copy link

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...

@COOLak
Copy link

COOLak commented Mar 20, 2019

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.

@dutty5
Copy link

dutty5 commented Apr 25, 2019

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

@simplecreatif
Copy link

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.

@bobdenotter
Copy link
Member

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

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

9 participants