Upgrading the code from Eex to Heex input readonly problem

In Phoenix 1.5 this works:

<input type="text" name="category" <%= if @busy , do: "readonly" %> />

But not in Phoenix 1.6

If I tried:

<input type="text" name="category"  { if @busy , do: "readonly" }  />

But I am getting this error:

# protocol Enumerable not implemented for nil of type Atom

The new Heex syntax is probably the reason why it is failing.

Any idea how to fix my code?


yep, the syntax of HEEx is really different, it’s just readonly={@busy}

The nice thing with HEEx about HTML boolean attributes like readonly is that if its value is false, the attribute will be omitted in the output.


Yeah, seems to be working. Thanks.