Unable see input field on liveView form

Here is my lib/fchatapp_web/live/chat_live.html.leex

<section>
    <div id="header-text">
        <div id="title">
        <p >Currently Chatting In <strong><%= @room %></strong></p>
        <button><a href="/">Leave Room</a></button>
        </div>
    </div>
    <br>

    <div id="chat-container">
        <div id="messages-container">Chat goes here</div>
        <%= f = form_for :chat, "#", id: "chat-form", phx_submit: :submit_message %>
        <% text_input f, :message, placeholder: "Enter your message..." %>
        </form>
    </div>
</section>

and also lib/fchatapp_web/live/chat_live.ex

defmodule FchatappWeb.ChatLive do
  use FchatappWeb, :live_view

  @imp true
  def mount(%{"room" => name}, session, socket) do
    IO.inspect "In mount"
#    IO.inspect room
#    IO.inspect params
    {:ok, assign(socket, room: name)}
  end

  @imp true
  def handle_event(room_id,params,socket) do
    IO.inspect "Im here"
    {:noreply, socket}
  end

end
<section>
    <div id="header-text">
        <div id="title">
        <p >Currently Chatting In <strong><%= @room %></strong></p>
        <button><a href="/">Leave Room</a></button>
        </div>
    </div>
    <br>

    <div id="chat-container">
        <div id="messages-container">Chat goes here</div>
        <%= f = form_for :chat, "#", id: "chat-form", phx_submit: :submit_message %>
        <% text_input f, :message, placeholder: "Enter your message..." %>
<%#     ^~~~ %>
        </form>
    </div>
</section>

You need to do <%= text_input f, :message, placeholder: "Enter your message..." %>. As it stands now with <% %> your input will not be sent to the browser.

1 Like

@voughtdq thanks for your reply
i have tried but this is not working for me

@voughtdq thanks deleted the _build and restarted the server and it worked