<cite>ismcagdas: </cite> Hi @exlnt,
Is the code you sent contains this issue as well ? If so, I will check the problem on source code.
Thanks.
Yes that source code has this same issue.
<cite>tteoh: </cite> FYI... Both links were broken.
Links do work, you just need to login into GIT.
<cite>ismcagdas: </cite> Hi,
Validation on the client side does not handled automatically. You need to first call .validate on your form, see <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/master/src/MyCompanyName.AbpZeroTemplate.Web/Areas/Mpa/Views/Users/_CreateOrEditModal.js#L27">https://github.com/aspnetzero/aspnet-ze ... dal.js#L27</a>.
Then before saving your form, you need to check if your form is valid or not <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/master/src/MyCompanyName.AbpZeroTemplate.Web/Areas/Mpa/Views/Users/_CreateOrEditModal.js#L56">https://github.com/aspnetzero/aspnet-ze ... dal.js#L56</a>.
Thanks.
Yes I am doing that. See my code below.
this.init = function (modalManager) {
_modalManager = modalManager;
_$form = _modalManager.getModal().find('form[name=CreateCompany]');
_$form.validate();
};
this.save = function () {
if (!_$form.valid()) {
return;
}
@ ismcagdas - I have also sent you an email on one other issue.
How can I enforce validation checking on my dropdowns?
<div class="form-group form-md-line-input">
@Html.DropDownList("CompanyId", Model.Companies.Select(i => i.ToSelectListItem()), new { @class = "form-control edited", required = String.Empty })
<label>@L("CompanyName2")</label>
</div>
The above dropdown is one example. This is how I implement them on most of my pages. Yet the model validation on these dropdowns does not fire or send a message to the user. It allows you to submit the form and the data is posted to the app service method, where it crashes due to this missing field.
Thank you very much! That did the trick!
I'm still struggling to come to grips with these DTO's. But I'm learning slowly! :D
I just upgraded all my ABP packages to version 1.5 is that release 3.3 here :[https://github.com/aspnetzero/aspnet-zero/releases/tag/v3.3.0])
Also, does this 3.3 release allow me to use VS2017 with my solution now?
I have an entity update method that is setting one of my key columns in one of my related tables for the entity with a NULL.
The issue happens from the Edit modal to the update company method in my app service. It updates the company entity table just fine. But then it seems to also NULL out the company Id column in my CompanyAddress table.
I have emailed you my solution for your review. Can you help to identify why this is happening? Thanks!
That worked!! Thanks very much!
I am now trying to add a dropdown into my editable html table, for the edit operation. I am using some JS code that I have used many time in my non ABP solutions. This is code that works. It is almost working here too in the ABP solution, but I am running into one issue.
[attachment=0:2bwqtg08]Screenshot (55).png[/attachment:2bwqtg08]
On the line with the red X, shown above, it keeps throwing an error that value is null. I have debugged this AJAX call, it reached my controller method and data is loaded into JSON object. You can see that the array is loaded with data on the right side panel. Yet when the above line in the JS code is reached, it keeps throwing NULL error. Is there something in the ABP template that is causing this behaviour/error?
I just tried this technique for another dropdown, for country and it is having the exact same issue.
Here is the exact error message I am getting and the response body from controller method.
Uncaught TypeError: Cannot read property 'value' of null
at eval (eval at <anonymous> (jquery.min.js:1), <anonymous>:77:82)
at Function.each (jquery.min.js:2)
at Object.success (eval at <anonymous> (jquery.min.js:1), <anonymous>:76:23)
at i (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at y (jquery.min.js:4)
at XMLHttpRequest.c (jquery.min.js:4)
{"result":
[{"disabled":false,
"group":null,
"selected":false,
"text":"--Please Choose--",
"value":"-"},
{"disabled":false,
"group":null,
"selected":false,
"text":"United States of America",
"value":"2"}],
"targetUrl":null,"success":true,"error":null,"unAuthorizedRequest":false,"__abp":true}
Thanks very much for the sample code, that was helpful! I have it working now, the app service method is getting called. I just need to fix a entity validation error now. Thanks again!
var _addressService = abp.services.app.address;
_addressService.updateAddress({
Id: aData[0],
AddressType: aData[1],
AddressLine1: aData[2],
AddressLine2: aData[3],
AddressLine3: aData[4],
City: aData[5],
StateId: 1,
CountryId: 1,
PostalCode: aData[8],
DefaultYN: aData[9]
}).done(function () {
alert("AddressSaved");
});