nickurban
I’ve been converting my EEX and LEEX to HEEX and so far it’s been working fine. But I ran into one problem that I couldn’t figure out.
If you have some javascript with string interpolation (e.g. to set a token), it throws errors about it.
Is HEEX intended to support <script> tags?
I was trying to do something like this:
<script>
fun("<%= @token %>");
</script>
I also tried this:
<script>
fun({@token});
</script>
The error is:
UndefinedFunctionError{arity: 1, function: :init, message: nil, module: AllegroWeb.Router, reason: nil}, [{AllegroWeb.Router, :init, [[]], []}, {AllegroWeb.Endpoint, :plug_builder_call, 2, [file: 'lib/allegro_web/endpoint.ex', line: 1]}, {AllegroWeb.Endpoint, :"call (overridable 3)", 2, [file: 'lib/plug/debugger.ex', line: 132]},
I know it looks weird that it can’t find Router.init, but I can confirm that is truly the error that happens, and if I change it back to leex it works fine again.
Thanks!
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Hello,
I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter).
The diffic...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Aludel - LLM Evaluation Workbench
Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
ruslandoga
Might be not ideal, but that seems to work for me.
APB9785
is
funan Elixir function? If so, that should be inside the<%= %>, not outside.I have script tags which are calling Elixir functions in several of my heex templates - no issues so far.
nickurban
Ah, I didn’t make that clear. It’s a JavaScript function.
APB9785
Can you do something like this?
benwilson512
I would use hooks for this and not this sort of thing.
BlueHatbRit
This is a minor problem for me as well, I’ve got some integrations in a phoenix (non-liveview) app such as Posthog which requires a block such as:
When putting this into a .heex file it just gives the error
I’ve just pulled it out into it’s own .eex file for now but it’s the only one left in my project unless I can figure out a more elegant solution. Any suggestions?
I’m not quite sure if this falls into the “bug” category but it certainly makes some things like this a bit more tricky, especially when various integrations provide this copy and paste block which a lot of people would hope “just works”. I could pull this into it’s own JS file I suppose but it feels like it adds some friction just to people using heex that eex or other systems don’t suffer from.
Apologies for reviving a slightly older thread, I thought it better for people searching this in the future to have a single thread to land on.
sodapopcan
Where is it you’re putting this?
root.html.heex? Somewhere else? And just to be clear, is that error from Elixir or JavaScript?kartheek
Heex performs html validation and there were few bugs in its html validation. You might be experiencing this bug:
https://github.com/phoenixframework/phoenix_live_view/issues/1656
Check the version of
phoenix_live_viewyou are using. Upgrading to the latest{:phoenix_live_view, "~> 0.17.6"}will help - many html validation bugs have been fixed in recent releases.If problem still exists after upgrading to latest - log a bug on phoenix_live_view repository.
Previous discussion in the forum: