How to check if a value is empty in eex

Hi, I would like to disable a text input if it’s not empty.
I’ve tried to use assigns but for some reasons I’m not able to make it work.
How should I write this condition in the most idiomatic way? In Rails I would probably interpolate the disabled attribute inside the text input with an inline guard, with Phoenix I’m a little lost.

Someone can give me a suggestion?

What do you mean ‘empty’? The usual values ([], nil, "", etc…) get rendered as empty strings in EEX. If you mean that the value is missing from the assign altogether then test for its existence first via something like:

<%= if assigns[:extra_action] do %>
  <%= @extra_action %>
<% end %>

Or more succinctly if you do not need surrounding html:

<%= if assigns[:extra_action], do: @extra_action %>
2 Likes