<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sivasothy Tharsa on Medium]]></title>
        <description><![CDATA[Stories by Sivasothy Tharsa on Medium]]></description>
        <link>https://medium.com/@sivasothytharsa17?source=rss-eeed62c89116------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*PeajRfCLVYE82u0-NkhTkw.jpeg</url>
            <title>Stories by Sivasothy Tharsa on Medium</title>
            <link>https://medium.com/@sivasothytharsa17?source=rss-eeed62c89116------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 12:25:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sivasothytharsa17/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Introduction]]></title>
            <link>https://medium.com/@sivasothytharsa17/by-sivasothy-tharsa-bsc-hons-in-software-engineering-associate-technical-consultant-business-a4063022a2c0?source=rss-eeed62c89116------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4063022a2c0</guid>
            <category><![CDATA[dynamics-365]]></category>
            <category><![CDATA[control-addin]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[dynamics-business-central]]></category>
            <category><![CDATA[navision]]></category>
            <dc:creator><![CDATA[Sivasothy Tharsa]]></dc:creator>
            <pubDate>Tue, 06 Oct 2026 09:25:39 GMT</pubDate>
            <atom:updated>2026-10-06T09:33:28.626Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Restoring NAV-Style Field Focus in Business Central with a Control Add-in</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ortKWOF1bDE3inYe7ivdWw.png" /></figure><h4>Introduction</h4><p>Developers who built scanner-driven pages in Dynamics NAV will remember how simple it was to control the cursor:</p><pre>Focus := &#39;ID1000000010&#39;;</pre><p>An operator scans a label, the page validates it, and the cursor lands on the next field that needs input. No mouse is involved, and the whole flow stays on the keyboard or scanner.</p><p>Business Central offers no equivalent AL statement for a card page. Once a trigger completes, the web client refreshes the page and decides where the cursor goes. Microsoft may add native support in future releases, so check the current documentation first. If your version has no such option, a control add-in can fill the gap.</p><p>This article walks through a practical approach, explains the problems you are likely to encounter, and shows how to solve each one.</p><h4>Approach</h4><p>A control add-in runs inside an iframe on the page. From there, JavaScript can reach the web client’s DOM through window.parent.document, locate a field&#39;s input element, and call focus() on it.</p><p>The implementation has three parts:</p><ol><li><em>A control add-in that exposes a single procedure.</em></li><li><em>A </em><em>usercontrol placed on the page.</em></li><li><em>An AL call wherever NAV used </em><em>Focus :=.</em></li></ol><p><strong><em>Important:</em></strong><em> This technique depends on the HTML that the Business Central web client renders. That markup is not a supported API and may change between releases. Keep the DOM-specific code in one file and retest after major updates.</em></p><p><strong>Step 1: Define the Control Add-in</strong></p><pre>controladdin &quot;Cursor Mover&quot;<br>{<br>    Scripts = &#39;Scripts/cursorMover.js&#39;;<br>    RequestedHeight = 1;<br>    RequestedWidth = 1;<br>    VerticalStretch = false;<br>    HorizontalStretch = false;</pre><pre>    procedure MoveCursorTo(ControlName: Text);<br>}</pre><p>The add-in has no visible interface, so it is sized to a single pixel.</p><h4>Step 2: Place It on the Page</h4><p>The example below is a simplified product scanning page. The operator scans a product barcode, and the cursor should move to the price field.</p><pre>page 50100 &quot;Product Scan&quot;<br>{<br>    PageType = Card;<br>    SourceTable = &quot;Product Buffer&quot;;</pre><pre>    layout<br>    {<br>        area(Content)<br>        {<br>            usercontrol(Mover; &quot;Cursor Mover&quot;)<br>            {<br>                ApplicationArea = All;<br>            }<br>            group(Scan)<br>            {<br>                field(ProductBarcode; BarcodeText)<br>                {<br>                    ApplicationArea = All;<br>                    Caption = &#39;Product Barcode&#39;;</pre><pre>                    trigger OnValidate()<br>                    begin<br>                        LoadProduct(BarcodeText);<br>                        CurrPage.Mover.MoveCursorTo(&#39;Price&#39;);<br>                        CurrPage.Update(false);<br>                    end;<br>                }<br>                field(Price; Rec.Price)<br>                {<br>                    ApplicationArea = All;<br>                    Editable = PriceEditable;<br>                }<br>            }<br>        }<br>    }</pre><pre>    var<br>        BarcodeText: Text[250];<br>        PriceEditable: Boolean;<br>}</pre><p>The key line is:</p><pre>CurrPage.Mover.MoveCursorTo(&#39;Price&#39;);</pre><p>It replaces NAV’s Focus :=. The procedure receives the AL control name rather than the caption, because captions can be translated or duplicated while control names remain stable.</p><h4>Step 3: Implement the JavaScript</h4><p>Business Central marks each field’s wrapper element with a controlname attribute that matches the control name in AL. This makes the field easy to locate.</p><p>A minimal version looks like this:</p><pre>function MoveCursorTo(controlName) {<br>    var page = window.parent.document;<br>    var box = page.querySelector(&#39;[controlname=&quot;&#39; + controlName + &#39;&quot;]&#39;);<br>    if (!box) return;</pre><pre>    var input = box.querySelector(&#39;input, textarea&#39;);<br>    if (!input) return;</pre><pre>    input.focus();<br>    input.select();<br>}</pre><p>This works in a simple demo but is not reliable on a real page, for the reasons below.</p><h4>Challenge 1: The Field Is Not Editable Yet</h4><p>In the example, Price remains read-only until the server round trip completes and the page re-renders. If the script runs too early, no editable input exists.</p><p><strong>Solution:</strong> Use a MutationObserver to react as soon as the page changes, and retry each time. Add a timeout so the script never waits indefinitely.</p><pre>function MoveCursorTo(controlName) {<br>    var page = window.parent.document;<br>    var watcher = null;<br>    var timeout = null;</pre><pre>    function findInput() {<br>        var box = page.querySelector(&#39;[controlname=&quot;&#39; + controlName + &#39;&quot;]&#39;);<br>        if (!box) return null;<br>        return box.querySelector(<br>            &#39;input:not([readonly]):not([disabled]), textarea:not([readonly]):not([disabled])&#39;<br>        );<br>    }</pre><pre>    function dialogIsOpen() {<br>        return !!page.querySelector(&#39;[role=&quot;dialog&quot;], [role=&quot;alertdialog&quot;]&#39;);<br>    }</pre><pre>    function stop() {<br>        if (watcher) watcher.disconnect();<br>        if (timeout) clearTimeout(timeout);<br>    }</pre><pre>    function tryToFocus() {<br>        if (dialogIsOpen()) return false;</pre><pre>        var input = findInput();<br>        if (!input) return false;</pre><pre>        input.focus();<br>        input.select();</pre><pre>        // The web client may restore focus elsewhere; verify once more.<br>        setTimeout(function () {<br>            if (page.activeElement !== input) {<br>                input.focus();<br>                input.select();<br>            }<br>        }, 200);</pre><pre>        stop();<br>        return true;<br>    }</pre><pre>    if (tryToFocus()) return;</pre><pre>    watcher = new MutationObserver(tryToFocus);<br>    watcher.observe(page.body, { childList: true, subtree: true, attributes: true });<br>    timeout = setTimeout(stop, 5000);<br>}</pre><p>Key points:</p><ul><li><strong>findInput</strong> returns the input only when it is neither read-only nor disabled.</li><li><strong>dialogIsOpen</strong> prevents the script from taking focus away from an error or confirmation dialog.</li><li><strong>MutationObserver</strong> retries whenever the page changes.</li><li><strong>The 5-second timeout</strong> ensures the script always terminates.</li></ul><h4>Challenge 2: The Web Client Reclaims Focus</h4><p>Occasionally the cursor lands in the correct field and then jumps back to the previously active element, because the page is still refreshing. The follow-up check after 200 ms handles this by restoring focus if it was lost.</p><h4>Best Practices</h4><ul><li><strong>Call the add-in before </strong><strong>CurrPage.Update(false)</strong> so the script is already watching when the refresh occurs.</li><li><strong>Choose the target field after setting editable flags.</strong> If a field is editable only under certain conditions, make the decision based on that state.</li><li><strong>Use control names, not captions.</strong></li><li><strong>Always clean up.</strong> Disconnect observers and clear timers when finished.</li><li><strong>Never interfere with dialogs.</strong></li></ul><h4>Related Issue: Tab Stops on Read-Only Fields</h4><p>In the web client, read-only inputs can still receive keyboard focus, so Tab may stop on fields the user cannot edit. To avoid this, add a capture-phase keydown listener on the parent document that builds a list of visible, editable inputs outside grids and dialogs, and moves to the next or previous item itself.</p><p>Take care with scanner fields. Most scanners send a Tab after the barcode. If your Tab handler moves focus at that moment, it competes with MoveCursorTo and the cursor ends up in the wrong place. Exclude any field whose OnValidate moves the cursor.</p><h4>Limitations</h4><ul><li>The solution relies on web client markup that Microsoft may change.</li><li>It crosses the iframe boundary through window.parent, which works in the standard web client but not in every hosting scenario.</li><li>It should be limited to pages that genuinely need it, such as scanner-driven pages.</li></ul><h3>Summary</h3><ul><li>NAV moved the cursor with one line: Focus := &#39;ID...&#39;.</li><li>Business Central has no such AL command for card pages.</li><li>A control add-in fills the gap: a small JavaScript file finds the field and calls focus() on it.</li><li>Call it from AL with CurrPage.Mover.MoveCursorTo(&#39;Price&#39;);, passing the control name, not the caption.</li><li>Wait until the field is editable, and check again if the web client moves the cursor back.</li><li>This relies on BC’s web page structure, so retest after major updates.</li></ul><p><em>By Sivasothy Tharsa<br>BSc (Hons) in Software Engineering<br>Associate Technical Consultant, Business Central / NAV</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4063022a2c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Laravel: A Beginner’s Guide]]></title>
            <link>https://medium.com/@sivasothytharsa17/getting-started-with-laravel-a-beginners-guide-ebaef4eae7e4?source=rss-eeed62c89116------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebaef4eae7e4</guid>
            <dc:creator><![CDATA[Sivasothy Tharsa]]></dc:creator>
            <pubDate>Thu, 27 Feb 2025 19:03:08 GMT</pubDate>
            <atom:updated>2025-02-27T19:03:08.311Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*41sizsIgA4EAFEJX.png" /></figure><p>Laravel is one of the most popular PHP frameworks for web development. It provides an elegant syntax, built-in tools, and follows the <strong>Model-View-Controller (MVC)</strong> pattern, making it easy to build powerful applications.</p><p>If you’re new to Laravel, this guide will walk you through the basics, from installation to building your first application.</p><h3>1. What is Laravel?</h3><p>Laravel is an open-source PHP framework used for building web applications. It was created by <strong>Taylor Otwell</strong> in 2011 and follows the Model-View-Controller (MVC) architecture. Laravel comes with a variety of built-in tools that make development cleaner and more efficient.</p><h3>Why Use Laravel?</h3><p>✅ <strong>Elegant Syntax —</strong> Laravel has a very clean and readable syntax that makes coding an enjoyable experience.<br>✅ <strong>Built-in Authentication —</strong> User authentication and authorization out of the box.<br>✅ <strong>Eloquent ORM —</strong> A powerful database abstraction layer that simplifies database interactions.<br>✅ <strong>Blade Templating Engine — </strong>A simple yet powerful templating engine for creating dynamic views.<br>✅ <strong>Artisan CLI — </strong>Automates common development tasks via command line.<br>✅ <strong>API Support — </strong>Built-in tools for developing RESTful APIs.<br>✅<strong>Security Features —</strong> Laravel provides protection against SQL injection, cross-site request forgery (CSRF), and XSS attacks.<br>✅<strong>Active Community Support —</strong> With thousands of contributors, Laravel has a vast ecosystem of packages and extensive documentation.</p><h3>2. Install and Setup Laravel</h3><p><strong>System Requirements</strong></p><p>Before installing Laravel, make sure your system meets the following requirements:</p><ul><li>PHP <strong>&gt;= 8.1</strong></li><li>Composer (PHP dependency manager)</li><li>A web server (Apache, Nginx)</li><li>MySQL, SQLite, PostgreSQL, or other supported database</li></ul><p><strong>Here’s a quick setup guide</strong></p><ol><li><strong>Create a new Laravel project using Composer</strong></li></ol><p>1.1 Open your terminal and run:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*Lozne2T2x0OWkuyDZdKukQ.png" /></figure><p>1.2 Alternatively, if the Laravel installer installed globally, can use:</p><ul><li>For install Laravel globally:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*WPWXlcYOQQ-SZGiZr3w30Q.png" /></figure><ul><li>After installed Laravel installer globally:</li></ul><p>For create new application,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*rqFcue2I40zx5kzH8gWJ7w.png" /></figure><p><strong>2. Start the Laravel Development Server</strong></p><p>Once Laravel is installed, navigate to your project directory and start the server:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*DfoS2JctoWjOH0FcRhmHhg.png" /></figure><p>This will run a local development server at http://127.0.0.1:8000, where you can access your Laravel application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebaef4eae7e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solving the “VirtualizedLists should never be nested inside plain ScrollViews” Error in React…]]></title>
            <link>https://medium.com/@sivasothytharsa17/solving-the-virtualizedlists-should-never-be-nested-inside-plain-scrollviews-error-in-react-fbd3cb4daeed?source=rss-eeed62c89116------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbd3cb4daeed</guid>
            <dc:creator><![CDATA[Sivasothy Tharsa]]></dc:creator>
            <pubDate>Sun, 24 Nov 2024 06:14:46 GMT</pubDate>
            <atom:updated>2024-11-24T06:14:46.566Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Solving the “VirtualizedLists should never be nested inside plain ScrollViews” Error in React Native</strong></h3><p>When working with React Native, performance is key, especially when managing complex UI elements like long lists. One common issue that developers face is the error message:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*R2T5FQFg20ZNxKq2V4ALfw.png" /></figure><p>This warning typically occurs when you nest a FlatList inside a ScrollView, both using the same orientation (either both horizontal or both vertical). Let’s explore what this error means, why it happens, and how you can solve it.</p><p><strong>What Causes the Error?</strong></p><p>React Native’s FlatList and ScrollView are both components designed for rendering lists and managing scrolling. However, they handle scrolling in different ways:</p><ul><li><strong>FlatList</strong>: This is an optimized component meant to render large datasets efficiently. It only renders the visible items in the list, which improves performance. It uses a technique called “windowing” to render only the items currently in view and to unload items that are off-screen.</li><li><strong>ScrollView</strong>: This is a simple scrolling container that renders all its children at once. While it’s fine for smaller datasets, it can be inefficient for large lists because it doesn’t have the same windowing mechanism that FlatList does.</li></ul><p>When you nest a FlatList inside a ScrollView with the same orientation (e.g., both horizontal scrolling), React Native encounters a conflict. Both components attempt to manage the scrolling behavior, which can lead to performance issues and broken functionality, including improper rendering and unresponsiveness.</p><p><strong>The Issue with Nesting FlatList in ScrollView</strong></p><p>In most cases, the primary problem arises when a FlatList is placed inside a ScrollView with the same direction of scrolling. This setup can prevent FlatList from using its windowing mechanism properly and can also cause redundant re-renders and performance bottlenecks. The result is poor user experience due to lagging or even crashes in some cases.</p><p><strong>How to Fix It</strong></p><p>Here are a few solutions to avoid nesting FlatList inside a ScrollView:</p><ol><li><strong>Remove the ScrollView Wrapper</strong>: If you’re already using FlatList, there’s no need for a wrapping ScrollView. FlatList is optimized to handle both scrolling and efficient rendering, so you can simply use it without the ScrollView.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*9tJUxvubcVzw8I3RYpS-Sw.png" /></figure><p>By doing this, the FlatList will handle scrolling on its own, and you avoid unnecessary nesting, which resolves the conflict.</p><p>2. <strong>Use FlatList for Scrolling</strong>: If your intention is to scroll through items horizontally or vertically, rely solely on FlatList. It has built-in support for both vertical and horizontal scrolling, making it the ideal choice for most list-based UIs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*N3vVrz8IQkzsd1vLayRH0g.png" /></figure><p>Here, we use FlatList with the horizontal prop to enable horizontal scrolling, and pagingEnabled for snapping to items. No ScrollView is needed in this case.</p><p>3. <strong>Disabling Scrolling in FlatList</strong>: If you still want to wrap the FlatList in a ScrollView for some reason, you can disable scrolling on the FlatList itself to prevent conflicts. This will allow the parent ScrollView to control the scrolling behavior while keeping the FlatList for efficient rendering of the items.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*FZj01VqXBegLJXcekNQyBg.png" /></figure><p>This approach lets the ScrollView handle the scroll behavior, while the FlatList remains responsible for rendering the list efficiently.</p><p><strong>Conclusion</strong></p><p>To avoid the “VirtualizedLists should never be nested inside plain ScrollViews” error in React Native, you should carefully manage how scrolling is handled within your components. FlatList is designed to optimize the rendering of large lists and should be used in place of ScrollView for efficient scrolling. By ensuring that only one container is responsible for handling the scroll behavior, you can improve the performance of your app and avoid errors caused by conflicting scrollable components.</p><p>By following these strategies, you’ll not only resolve the error but also ensure a smoother, more responsive experience for your users.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbd3cb4daeed" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>