diff --git a/Classy.DotNet.Mvc/Controllers/ListingController.cs b/Classy.DotNet.Mvc/Controllers/ListingController.cs index 1ce1df0..f09835d 100644 --- a/Classy.DotNet.Mvc/Controllers/ListingController.cs +++ b/Classy.DotNet.Mvc/Controllers/ListingController.cs @@ -510,6 +510,14 @@ public ActionResult EditListing(UpdateListingViewModel model) Dictionary errors = new Dictionary(); + if (string.IsNullOrWhiteSpace(model.Title)) + { + errors.Add("Title", Localizer.Get("CreateListing_TitleRequired")); + } + if (string.IsNullOrWhiteSpace(model.Content)) + { + errors.Add("Content", Localizer.Get("CreateListing_ContentRequired")); + } if (string.IsNullOrWhiteSpace(Request["Categories[]"])) { errors.Add("Categories", Localizer.Get("CreateListing_CategoryRequired")); diff --git a/MyHome/Deployment/Resources/edit-product.resm b/MyHome/Deployment/Resources/edit-product.resm index be0dde6..17f4d5e 100644 --- a/MyHome/Deployment/Resources/edit-product.resm +++ b/MyHome/Deployment/Resources/edit-product.resm @@ -252,6 +252,20 @@ "Values": { "en": "Please provide basic product info" } + }, + { + "Key": "CreateListing_ContentRequired", + "Description": "Description required validation message", + "Values": { + "en": "Description is required" + } + }, + { + "Key": "CreateListing_TitleRequired", + "Description": "Title required validation message", + "Values": { + "en": "Title is required" + } } ] } diff --git a/MyHome/Views/Product/CreateProduct.cshtml b/MyHome/Views/Product/CreateProduct.cshtml index 57cb3c1..3d247e1 100644 --- a/MyHome/Views/Product/CreateProduct.cshtml +++ b/MyHome/Views/Product/CreateProduct.cshtml @@ -202,6 +202,7 @@ $(".overlay").hide(); var fields = ["Title", "Content", "ProductUrl", "SKU", "CompareAtPrice", "Price", "Quantity", "Width", "Depth", "Height"]; $("#globalVS").toggleClass("hidden", true); + $("#globalVS").find("ul").html(""); if (response.errors) { for (var i = 0; i < fields.length; i++) { if (response.errors[fields[i]]){ diff --git a/MyHome/Views/Product/EditProduct.cshtml b/MyHome/Views/Product/EditProduct.cshtml index d863784..1551689 100644 --- a/MyHome/Views/Product/EditProduct.cshtml +++ b/MyHome/Views/Product/EditProduct.cshtml @@ -278,6 +278,7 @@ $(".overlay").hide(); var fields = ["Title", "Content", "ProductUrl", "SKU", "CompareAtPrice", "Price", "Quantity", "Width", "Depth", "Height"]; $("#globalVS").toggleClass("hidden", true); + $("#globalVS").find("ul").html(""); if (response.errors) { for (var i = 0; i < fields.length; i++) { if (response.errors[fields[i]]){