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

Alert title and message blank when using redirect()->withErrors() #130

Open
hakimzulkufli opened this issue Oct 19, 2020 · 3 comments
Open

Comments

@hakimzulkufli
Copy link

hakimzulkufli commented Oct 19, 2020

Description

Alert title and message blank when using redirect()-back()->withErrors($validator). Perhaps I am doing this wrong? I would like to skip the usage of Middleware if possible. See the image below:

image

Package Version: 2.0.5
Laravel Version: 6.18.41

Steps to Reproduce

  1. Use a validator() helper to validate $request.
  2. On validator()->fails(), call alert() helper. (Usage of alert() helper of the SweetAlert facade does not matter as neither works.)
  3. Use redirect()-back()->withErrors($validator) after alert() helper.

Sample Code

public function store(Request $request)
{
        $validator = validator()->make($request->all(), [
            'name' => 'required|string'
        ]);

        if($validator->fails()) {
            alert()->error(__('Please check your entries and submit again.'), __('Invalid Submission'))->persistent('OK');

            return redirect()->back()
                ->withInput()
                ->withErrors($validator);
        }

        // ...
}
@hakimzulkufli
Copy link
Author

hakimzulkufli commented Oct 19, 2020

Upon inspection, I noticed that this empty popup will appear every time I use withErrors() even without calling alert(). This will also cause the blank popup:

// ...

$request->validate([
            'name' => 'required|string',
]);

// ...

@interludic
Copy link

I can confirm this is still an issue
L8 "uxweb/sweet-alert": "^2.0",

@interludic
Copy link

Looks like this is abandoned so using https://github.com/realrashid/sweet-alert for the time being. it doesn't have the withErrors problem

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