Month: January 2022

  • Javascript and contenteditable how to move the cursor to the end of user input

    Javascript and contenteditable how to move the cursor to the end of user input

    This appears to work in all browsers. Let me know if you find issues. So this is something I needed to do and all the examples I found didn’t work properly. Or they worked partially, or only in one browser. The idea seems super simple, but in reality the problem becomes complex for several reasons. […]

  • Javascript event listeners be careful where you bind this

    Javascript event listeners be careful where you bind this

    In Javascript User interface programming you often need to work with EventListeners. In modern Javascript you may also be doing this in a class, which is handy. One of theĀ  things that sucks about Javascript event listeners is they eat memory and slow your app down, if you are not REALLY careful. They do this […]

  • How to update your FosJsRoutingBundle routes file

    When you add a new route to one of your Symfony API routes aka your controllers, you will need to recreate the JSON routing file that FosJsRoutingBundle uses. To do that you use this simple command. php bin/console fos:js-routing:dump –format=json –target=public/js/fos_js_routes.json This command will rewrite your existing routes JSON file located in the public folder […]

  • How to view Symfony 5+ FosJsRoutingBundle routes

    How to view Symfony 5+ FosJsRoutingBundle routes

    I can never remember this command. However, now that I am creating more AJAX and exposing endpoints I need this command more often. This command is found in the docs too. But I can never remember where, so I will write about it here. The command to view how FosJsRoutingBundle views your routes. php bin/console […]

  • How to view Symfony routes

    I often need to view my current routes and how the Symfony kernel views them. This usually happens when I am adding new routes, I end up getting conflicts and have to resolve them by viewing what exists etc. The command to view your routes is really simple. Open your console and navigate to your […]

  • Symfony how to get query string values sent by AJAX calls

    Symfony how to get query string values sent by AJAX calls

    When using a Symfony API endpoint for getting values such as maybe something like an auto-complete feature you will need to be able to send some text(what the user enters) to the backend. Then have the backend return a response based on that. For example with an auto complete feature, you might want to send […]