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

Error Sending Form After Updating to 2.1.0 #2

Closed
kombimedia opened this issue Nov 22, 2021 · 6 comments
Closed

Error Sending Form After Updating to 2.1.0 #2

kombimedia opened this issue Nov 22, 2021 · 6 comments

Comments

@kombimedia
Copy link

kombimedia commented Nov 22, 2021

Describe the bug
I have updated to the latest version of the plugin 2.1.0 and run the database patch. Now when a form is submitted an alert window pops up with a 'something went wrong' message.

To Reproduce
Steps to reproduce the behavior:

  1. Go to a form on the front end
  2. Complete the form fields
  3. Click submit
  4. Alert message pops up with 'something went wrong' alert message

Expected behavior
I expected the form to submit

Screenshots
Screen Shot 2021-11-22 at 15 24 29

Screen Shot 2021-11-22 at 15 40 38

October version
2.1.21

Plugin version
2.1.0

Additional Details
I am extending the FormBuilder plugin to dynamically set the recipient name and email before the message is sent.

     public function boot() {
      \Event::listen('formBuilder.beforeSendMessage', function ($form, $data) {
        $form->to_email = $data['recipient_email'];
        $form->to_name = $data['recipient_name'];

      });

Hope you can help.

Cy

@mplodowski
Copy link
Owner

Please go to the backend Settings -> Event Log. There should be error record. Copy and paste error message and stack trace.

In new version to_email and to_name field are replaced with repeater recipients field.

I think you can remove this boot method and use Autoresponder feature, where you can specify which fields to use and even the mail template.

@mplodowski
Copy link
Owner

If you want to use boot method to change recipients than this is the code to use now:

\Event::listen('formBuilder.beforeSendMessage', function ($form, $data) {
    $form->recipients = [
        [
            'email' => $data['recipient_email'],
            'recipient_name' => $data['recipient_name'],
        ]
    ];
});

@kombimedia
Copy link
Author

Hi @mplodowski,

Thanks for your speedy response.

There was no event logged for this error.

Thanks also for the updated boot method snippet. Because the email recipient will always need to be dynamically injected I have gone for this method to override the default recipient, preventing two emails being sent.

Cheers

@mplodowski
Copy link
Owner

Without seeing error message there is very limited way to help you.

The only way to see this error is to enable APP_DEBUG = true in .env file.

You can also run: composer update in project root.

The last resort should be reinstalling plugin, but can cause data loss.

@kombimedia
Copy link
Author

@mplodowski,

Sorry, I wasn't clear. I'm not receiving the error anymore. I have updated my boot method to the one you provided, and removed un-required recipient repeaters that had been generated after upgrading to 2.1.0. I think the error i was receiving was due to a 'new recipient' not having an email address defined.

Thanks

@mplodowski
Copy link
Owner

Super! I am glad it works now.

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

2 participants