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

redirect after create fails #46

Open
Allann opened this issue Oct 29, 2020 · 3 comments
Open

redirect after create fails #46

Allann opened this issue Oct 29, 2020 · 3 comments

Comments

@Allann
Copy link

Allann commented Oct 29, 2020

Not sure if I have done something wrong or if there is a setting I have missed. I grabbed your master branch and it is doing the same.

Repro:

  • Open project
  • Select Student
  • Click Create New
  • Enter valid details
  • Click Save

The redirect triggers and you now see json on the page: {"redirect":"/Students"} on the URL: https://localhost:44375/Students/Create

I would have expected to navigate back to the Student Index page.

@RickTheHat
Copy link

RickTheHat commented Jan 24, 2021

The code that does the redirect is in "wwwroot/js/site.js" so if you're creating a new project, you will want to add this as the "return this.RedirectToPageJson("Index");" uses it to do the redirect.

See pic below...

CapturFiles-20210124_082334

@RickTheHat
Copy link

RickTheHat commented Jan 24, 2021

Take note that bootstrap was updated to v4 in this latest code so classes like "has-error" are gone and I now get flashing for validation but I just comment out the @Html.ValidationDiv() and go back to the original validation.

As I work my way thru learning this new architecture (which I like very much!!!) ... I'll see if I an fix it and make a PR for others running into this issue.

This works for me for now

<div asp-validation-summary="ModelOnly" class="text-danger"></div>
@* @Html.ValidationDiv() *@

@cdgipson
Copy link

Something in this method or sub-methods was throwing an error stating that it could not find _.reject(). I found this by adding the alert statement to the catch.

var highlightErrors = function (xhr) {
    try {
        var data = JSON.parse(xhr.responseText);
        highlightFields(data);
        showSummary(data);
        window.scrollTo(0, 0);
    } catch (e) {
        alert(e);
        // (Hopefully) caught by the generic error handler in `config.js`.
    }
};

To fix this, I had to replace the following.

<script src="~/lib/lodash/dist/core.js"></script>

with this

<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>

Hope this helps.

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

3 participants