Open terryaney opened 3 years ago
Some packages got updated and I'm sure they could be fixed i.e bootstrap was upgraded to 4.3.1 but there's code that references bootstrap 3.3.7 (see pic ... I don't think the flash of validation is supposed to work that way). If I'm able to fix these while I learn more about this vertical slice architecture, I'll create a PR.
I needed to move the following scripts to the header in order for it to work. Don't know why this should make a difference but it did.
<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/lodash/dist/core.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.js"></script>
<script src="~/js/site.js"></script>
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/lodash@4.17.21/lodash.min.js"></script>
Hope this helps.
I select an Instructor, go to the Edit page and clear everything out and hit save.
I then get a script error what _.reject() is not a function in showSummary().
I looked at your normal Contoso repo (I didn't pull/test) and noticed that the lodash folder has many more files in it instead of only core.js. I didn't see a libman.json to try and update the libraries, so not sure if I'm missing something and didn't build correctly (just hit F5 and it worked) or if there is a problem with the script.
Additionally, if I instead of clearing all inputs and submitting, I just append the letter 'a' to the date hire and submit. It submits successfully, redirects to listing page, but did not display error nor save bad data.
Side question when you look at this. Trying to understand where the ajax call submits to when clicking submit on Edit page. The form.action is
undefined
and I put break points in all the methods in CreateEdit.cshtml.cs and never hit any of them.