Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

mvc core &jQuery - modal edit date not populating #8759


User avatar
0
Siyeza created

on edit, date field is not showing.


21 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    hi siyeza

    Can you share screenshots? And the steps to reproduce the problem.

  • User Avatar
    0
    Siyeza created

    https://insureserveuat.co.za/ client : Default (case sensitive) username : maliming password : 1020

    Main->Policies->'Actions'-Edit (you will notice that there is a field there Inception Date), but when you select 'Edit' it is not binded into the dialog

    I hope this is clear...

  • User Avatar
    0
    ismcagdas created
    Support Team
  • User Avatar
    0
    Siyeza created

    This is another RAD generated entity. See the property/field 'InceptionDate' which is of DateTime - when EDITING, that field doesnt get populated. See below. cshtml & js files


    <div class="modal-body"> <div id="PolicyInformationsTab"> <form name="PolicyInformationsForm" role="form" novalidate class="form-validation">

            @if (Model.IsEditMode)
            {
                &lt;input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;@Model.Policy.Id&quot; /&gt;
            }
    
    
            &lt;div class=&quot;form-group m-form__group&quot;&gt;
                &lt;label for=&quot;PaymentDayDescrition&quot;&gt;@L("PaymentDay")&lt;/label&gt;
                &lt;div class=&quot;input-group&quot;&gt;
                    &lt;input class=&quot;form-control&quot; id=&quot;PaymentDayDescrition&quot; name=&quot;paymentDayDescrition&quot; value=&quot;@Model.PaymentDayDescrition&quot; type=&quot;text&quot; disabled&gt;
                    &lt;div class=&quot;input-group-append&quot;&gt;
                        &lt;button class=&quot;btn btn-primary blue&quot; id=&quot;OpenPaymentDayLookupTableButton&quot; type=&quot;button&quot;&gt;&lt;i class=&quot;fa fa-search&quot;&gt;&lt;/i&gt; @L("Pick")&lt;/button&gt;
                    &lt;/div&gt;
                    &lt;div class=&quot;input-group-prepend&quot;&gt;
                        &lt;button class=&quot;btn btn-danger&quot; type=&quot;button&quot; id=&quot;ClearPaymentDayDescritionButton&quot;&gt;&lt;i class=&quot;fa fa-times&quot;&gt;&lt;/i&gt;&lt;/button&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
    
            @if (Model.IsEditMode)
            {
                &lt;input class=&quot;form-control&quot; value=&quot;@Model.Policy.PaymentDayId&quot; type=&quot;text&quot; name=&quot;paymentDayId&quot; required hidden /&gt;
            }
            else
            {
                &lt;input class=&quot;form-control&quot; value=&quot;&quot; type=&quot;text&quot; name=&quot;paymentDayId&quot; required hidden /&gt;
            }
    
    
            &lt;div class=&quot;form-group m-form__group&quot;&gt;
                &lt;label for=&quot;PolicyStatusDescription&quot;&gt;@L("PolicyStatus")&lt;/label&gt;
                &lt;div class=&quot;input-group&quot;&gt;
                    &lt;input class=&quot;form-control&quot; id=&quot;PolicyStatusDescription&quot; name=&quot;policyStatusDescription&quot; value=&quot;@Model.PolicyStatusDescription&quot; type=&quot;text&quot; disabled&gt;
                    &lt;div class=&quot;input-group-append&quot;&gt;
                        &lt;button class=&quot;btn btn-primary blue&quot; id=&quot;OpenPolicyStatusLookupTableButton&quot; type=&quot;button&quot;&gt;&lt;i class=&quot;fa fa-search&quot;&gt;&lt;/i&gt; @L("Pick")&lt;/button&gt;
                    &lt;/div&gt;
                    &lt;div class=&quot;input-group-prepend&quot;&gt;
                        &lt;button class=&quot;btn btn-danger&quot; type=&quot;button&quot; id=&quot;ClearPolicyStatusDescriptionButton&quot;&gt;&lt;i class=&quot;fa fa-times&quot;&gt;&lt;/i&gt;&lt;/button&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
    
            @if (Model.IsEditMode)
            {
                &lt;input class=&quot;form-control&quot; value=&quot;@Model.Policy.PolicyStatusId&quot; type=&quot;text&quot; name=&quot;policyStatusId&quot; required hidden /&gt;
            }
            else
            {
                &lt;input class=&quot;form-control&quot; value=&quot;&quot; type=&quot;text&quot; name=&quot;policyStatusId&quot; required hidden /&gt;
            }
    
    
            &lt;div class=&quot;form-group m-form__group&quot;&gt;
                &lt;label for=&quot;PolicyTypeDescription&quot;&gt;@L("PolicyType")&lt;/label&gt;
                &lt;div class=&quot;input-group&quot;&gt;
                    &lt;input class=&quot;form-control&quot; id=&quot;PolicyTypeDescription&quot; name=&quot;policyTypeDescription&quot; value=&quot;@Model.PolicyTypeDescription&quot; type=&quot;text&quot; disabled&gt;
                    &lt;div class=&quot;input-group-append&quot;&gt;
                        &lt;button class=&quot;btn btn-primary blue&quot; id=&quot;OpenPolicyTypeLookupTableButton&quot; type=&quot;button&quot;&gt;&lt;i class=&quot;fa fa-search&quot;&gt;&lt;/i&gt; @L("Pick")&lt;/button&gt;
                    &lt;/div&gt;
                    &lt;div class=&quot;input-group-prepend&quot;&gt;
                        &lt;button class=&quot;btn btn-danger&quot; type=&quot;button&quot; id=&quot;ClearPolicyTypeDescriptionButton&quot;&gt;&lt;i class=&quot;fa fa-times&quot;&gt;&lt;/i&gt;&lt;/button&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
    
            @if (Model.IsEditMode)
            {
                &lt;input class=&quot;form-control&quot; value=&quot;@Model.Policy.PolicyTypeId&quot; type=&quot;text&quot; name=&quot;policyTypeId&quot; required hidden /&gt;
            }
            else
            {
                &lt;input class=&quot;form-control&quot; value=&quot;&quot; type=&quot;text&quot; name=&quot;policyTypeId&quot; required hidden /&gt;
            }
    
    
            &lt;div class=&quot;form-group m-form__group&quot;&gt;
                &lt;label for=&quot;PolicyHolderFullNames&quot;&gt;@L("PolicyHolder")&lt;/label&gt;
                &lt;div class=&quot;input-group&quot;&gt;
                    &lt;input class=&quot;form-control&quot; id=&quot;PolicyHolderFullNames&quot; name=&quot;policyHolderFullNames&quot; value=&quot;@Model.PolicyHolderFullNames&quot; type=&quot;text&quot; disabled&gt;
                    &lt;div class=&quot;input-group-append&quot;&gt;
                        &lt;button class=&quot;btn btn-primary blue&quot; id=&quot;OpenPolicyHolderLookupTableButton&quot; type=&quot;button&quot;&gt;&lt;i class=&quot;fa fa-search&quot;&gt;&lt;/i&gt; @L("Pick")&lt;/button&gt;
                    &lt;/div&gt;
                    &lt;div class=&quot;input-group-prepend&quot;&gt;
                        &lt;button class=&quot;btn btn-danger&quot; type=&quot;button&quot; id=&quot;ClearPolicyHolderFullNamesButton&quot;&gt;&lt;i class=&quot;fa fa-times&quot;&gt;&lt;/i&gt;&lt;/button&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
    
            @if (Model.IsEditMode)
            {
                &lt;input class=&quot;form-control&quot; value=&quot;@Model.Policy.PolicyHolderId&quot; type=&quot;text&quot; name=&quot;policyHolderId&quot; required hidden /&gt;
            }
            else
            {
                &lt;input class=&quot;form-control&quot; value=&quot;&quot; type=&quot;text&quot; name=&quot;policyHolderId&quot; required hidden /&gt;
            }
    
    
    
    
            &lt;div class=&quot;form-group&quot;&gt;
                &lt;label for=&quot;Policy_ReferenceNumber&quot;&gt;@L("ReferenceNumber")&lt;/label&gt;
                &lt;input class=&quot;form-control&quot; id=&quot;Policy_ReferenceNumber&quot; value=&quot;@Model.Policy.ReferenceNumber&quot; type=&quot;text&quot; name=&quot;referenceNumber&quot; required maxlength=&quot;@insureserve.Main.Policy.PolicyConsts.MaxReferenceNumberLength&quot; minlength=&quot;@insureserve.Main.Policy.PolicyConsts.MinReferenceNumberLength&quot; /&gt;
            &lt;/div&gt;
    
    
    
    
           &lt;div class=&quot;form-group&quot;&gt;
                &lt;label for=&quot;Policy_InceptionDate&quot;&gt;@L("InceptionDate")&lt;/label&gt;
                &lt;input class=&quot;form-control m-input date-picker&quot; id=&quot;Policy_InceptionDate&quot; type=&quot;text&quot; name=&quot;inceptionDate&quot; value=&quot;@Model.Policy.InceptionDate&quot; /&gt;
            &lt;/div&gt;
    
    
        &lt;/form&gt;
    &lt;/div&gt;
    

    </div>

    SCRIPT

    (function ($) { app.modals.CreateOrEditPolicyModal = function () {

        var _policiesService = abp.services.app.policies;
    
        var _modalManager;
        var _$policyInformationForm = null;
    
        var _paymentDayLookupTableModal = new app.ModalManager({
            viewUrl: abp.appPath + 'App/Policies/PaymentDayLookupTableModal',
            scriptUrl: abp.appPath + 'view-resources/Areas/App/Views/Policies/_PaymentDayLookupTableModal.js',
            modalClass: 'PaymentDayLookupTableModal'
        }); var _policyStatusLookupTableModal = new app.ModalManager({
            viewUrl: abp.appPath + 'App/Policies/PolicyStatusLookupTableModal',
            scriptUrl: abp.appPath + 'view-resources/Areas/App/Views/Policies/_PolicyStatusLookupTableModal.js',
            modalClass: 'PolicyStatusLookupTableModal'
        }); var _policyTypeLookupTableModal = new app.ModalManager({
            viewUrl: abp.appPath + 'App/Policies/PolicyTypeLookupTableModal',
            scriptUrl: abp.appPath + 'view-resources/Areas/App/Views/Policies/_PolicyTypeLookupTableModal.js',
            modalClass: 'PolicyTypeLookupTableModal'
        }); var _policyHolderLookupTableModal = new app.ModalManager({
            viewUrl: abp.appPath + 'App/Policies/PolicyHolderLookupTableModal',
            scriptUrl: abp.appPath + 'view-resources/Areas/App/Views/Policies/_PolicyHolderLookupTableModal.js',
            modalClass: 'PolicyHolderLookupTableModal'
        });
    
        this.init = function (modalManager) {
            _modalManager = modalManager;
    
            var modal = _modalManager.getModal();
            modal.find('.date-picker').datetimepicker({
                locale: abp.localization.currentLanguage.name,
                format: 'L'
            });
    
            _$policyInformationForm = _modalManager.getModal().find('form[name=PolicyInformationsForm]');
            _$policyInformationForm.validate();
        };
    
        $('#OpenPaymentDayLookupTableButton').click(function () {
    
            var policy = _$policyInformationForm.serializeFormToObject();
    
            _paymentDayLookupTableModal.open({ id: policy.paymentDayId, displayName: policy.paymentDayDescrition }, function (data) {
                _$policyInformationForm.find('input[name=paymentDayDescrition]').val(data.displayName);
                _$policyInformationForm.find('input[name=paymentDayId]').val(data.id);
            });
        });
    
        $('#ClearPaymentDayDescritionButton').click(function () {
            _$policyInformationForm.find('input[name=paymentDayDescrition]').val('');
            _$policyInformationForm.find('input[name=paymentDayId]').val('');
        });
    
        $('#OpenPolicyStatusLookupTableButton').click(function () {
    
            var policy = _$policyInformationForm.serializeFormToObject();
    
            _policyStatusLookupTableModal.open({ id: policy.policyStatusId, displayName: policy.policyStatusDescription }, function (data) {
                _$policyInformationForm.find('input[name=policyStatusDescription]').val(data.displayName);
                _$policyInformationForm.find('input[name=policyStatusId]').val(data.id);
            });
        });
    
        $('#ClearPolicyStatusDescriptionButton').click(function () {
            _$policyInformationForm.find('input[name=policyStatusDescription]').val('');
            _$policyInformationForm.find('input[name=policyStatusId]').val('');
        });
    
        $('#OpenPolicyTypeLookupTableButton').click(function () {
    
            var policy = _$policyInformationForm.serializeFormToObject();
    
            _policyTypeLookupTableModal.open({ id: policy.policyTypeId, displayName: policy.policyTypeDescription }, function (data) {
                _$policyInformationForm.find('input[name=policyTypeDescription]').val(data.displayName);
                _$policyInformationForm.find('input[name=policyTypeId]').val(data.id);
            });
        });
    
        $('#ClearPolicyTypeDescriptionButton').click(function () {
            _$policyInformationForm.find('input[name=policyTypeDescription]').val('');
            _$policyInformationForm.find('input[name=policyTypeId]').val('');
        });
    
        $('#OpenPolicyHolderLookupTableButton').click(function () {
    
            var policy = _$policyInformationForm.serializeFormToObject();
    
            _policyHolderLookupTableModal.open({ id: policy.policyHolderId, displayName: policy.policyHolderFullNames }, function (data) {
                _$policyInformationForm.find('input[name=policyHolderFullNames]').val(data.displayName);
                _$policyInformationForm.find('input[name=policyHolderId]').val(data.id);
            });
        });
    
        $('#ClearPolicyHolderFullNamesButton').click(function () {
            _$policyInformationForm.find('input[name=policyHolderFullNames]').val('');
            _$policyInformationForm.find('input[name=policyHolderId]').val('');
        });
    
    
    
        this.save = function () {
            if (!_$policyInformationForm.valid()) {
                return;
            }
    
            var policy = _$policyInformationForm.serializeFormToObject();
    
            _modalManager.setBusy(true);
            _policiesService.createOrEdit(
                policy
            ).done(function () {
                abp.notify.info(app.localize('SavedSuccessfully'));
                _modalManager.close();
                abp.event.trigger('app.createOrEditPolicyModalSaved');
            }).always(function () {
                _modalManager.setBusy(false);
            });
        };
    };
    

    })(jQuery);

  • User Avatar
    0
    Siyeza created

    on the javascript above, see my comments below...if you can help with that

        var modal = _modalManager.getModal();
            //modal.find('Policy_InceptionDate').datetimepicker({      **//this brings up the DATE (BUT) the date picker stops working**
            modal.find('.date-picker').datetimepicker({                       **//this here does not bring up the DATE (BUT) datepicker continues to work**
                locale: abp.localization.currentLanguage.name,
                format: 'L'
            });
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @Jobe,

    We will test this and fix the problem.

  • User Avatar
    0
    Siyeza created

    Hi, any progress on this? It is giving us some real problems. Was not tested proper..now it is on production

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Jobe,

    We will release the fix on monday or tuesday.

  • User Avatar
    0
    musa.demir created

    Hi @Jobe, I could not reproduce it. Can you please send your project to [email protected] with that issue number.

  • User Avatar
    0
    Siyeza created

    Hi @demirmusa, you may please give me an email address that u can use on git, I will give you access to my repository, then you can run it locally...is that fine? If yes, please give me your email.

  • User Avatar
    0
    musa.demir created

    Hi @Jobe

    My github name is demirmusa you can invite me to your repo by using that

  • User Avatar
    0
    Siyeza created

    Hi @demirmusa, I am using DevOps ... I will need just an email...

  • User Avatar
    0
    Siyeza created

    Hi, anything here?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Jobe,

    We will send the email addres to your email.

    Thanks,

  • User Avatar
    0
    Siyeza created

    hi @ismcagdas, I have added the email to my private repository. This is really strange. What I have just did, I created another simple entity using the RAD tool with some few fields and the date. That worked. The code looks axaclty the same. Please help guys.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Thanks, we will take a look at your app.

  • User Avatar
    0
    Siyeza created

    Hi any progress on this?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Jobe,

    We are working on your project and will inform you soon. Sorry for the delay.

  • User Avatar
    0
    musa.demir created

    I responded you via mail. Did you get it?

  • User Avatar
    0
    Siyeza created

    I did get the email. I am not sure how are we going to go around this one. I am going to close this for now.

  • User Avatar
    0
    musa.demir created

    Hello @Jobe

    We made fixes about datetime properties in Power Tools. It may fix your problem. They will be included to next release.