I'm trying to figure out what I can use on the embedded elixir front to check if something is a number.
This is my code
<%= form_for @changeset, @action, fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>Oops, something went wrong! Please check the errors below.</p>
</div>
<% end %>
<!--- CAN I CHECK if @action is integer here? -->
<%=if Integer.parse(@action) %>
<div class="form-item">
<%= label f, :shipping_address, class: "is-req" %>
<%= text_input f, :sender_address %>
<%= error_tag f, :label %>
</div>
<div class="form-item">
<%= label f, :Receiver_Group_Name, class: "is-req" %>
<%= text_input f, :reciever_group_name %>
<%= error_tag f, :reciever_group_name %>
</div>
<div class="form-item">
<%= label f, :Shipping_Items, class: "is-req" %>
<%= text_input f, :items %>
<%= error_tag f, :items %>
</div>
<div class="form-item">
<%= label f, :Funding, class: "is-req" %>
<%= text_input f, :funding %>
<%= error_tag f, :funding %>
</div>
<div class="form-item is-text-center">
<%= submit "Submit", class: "button is-big" %>
</div>
<% end %>
So I already know Integer.parse() doesn't work on the front end, but is there anything similar I could use to check a variable? Is there a way I can interface the @action with javascript if not?
First project with elixir/Phoenix, any tips are appreciated.