Open Closed

Change Date Input #8177


User avatar
0
nabass created

hi I have 2 date inputs so i made a logic when changing on one of them another on will updated auto as code below when i tried same js code on normal html file it works perfectly when i use same code on ABP it doesn't work so is there a special something i should do first ??

<abp-column size="_4"> <abp-date-picker id="documentDate" auto-update-input="true" today-button-classes="btn-primary" asp-for="Purchase.DocumentDate" label="@L["DocumentDate"].Value" /> </abp-column> <abp-column size="_4"> <abp-date-picker id="vendorInvoiceDate" auto-update-input="true" today-button-classes="btn-primary" asp-for="Purchase.VendorInvoiceDate" label="@L["VendorInvoiceDate"].Value" /> </abp-column> <script> const vendorInvoiceDate = document.getElementById('vendorInvoiceDate'); const documentDate = document.getElementById('documentDate'); vendorInvoiceDate.addEventListener('change', function (event) {
documentDate.value = event.target.value; }); </script>

  • ABP Framework version: v8.0.2
  • UI Type: MVC
  • Database System: EF Core (SQL Server,)

2 Answer(s)
  • User Avatar
    0
    salih created
    Support Team .NET Developer

    Hi, abp-date-picker uses jquery, so if you replace your code as jquery code it will work.

    document.addEventListener('DOMContentLoaded', function () {
        const $vendorInvoiceDate = $('#vendorInvoiceDate');
        const $documentDate = $('#documentDate');
        $vendorInvoiceDate.on('change', function () {
            $documentDate.val($vendorInvoiceDate.val());
        });
    });
    
  • User Avatar
    0
    nabass created

    hi salih it works thank you :)

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09