liveview-native / liveview-client-html

MIT License
1 stars 0 forks source link

Simple form not valid inside of html template. #3

Open BrooklinJazz opened 3 weeks ago

BrooklinJazz commented 3 weeks ago

I noticed the simple_form component doesn't seem to work when using the liveview-client-html library with a render component.

Here's my template:

<h1 class="text-2xl">Chat App</h1>
<section class="h-[400px] overflow-y-scroll">
    <%= for message <- @messages do %>
    <p><%= message.name %></p>
    <p class="mb-2"><%= message.content %></p>
    <% end %>
</section>

<.simple_form for={@form} id="form" phx-submit="send-message">
    <.input field={@form[:name]} placeholder="From..." />
    <.input field={@form[:content]} placeholder="Say..." />
    <:actions>
        <.button type="submit">
            Send Message
        </.button>
    </:actions>
</.simple_form>

Here's my render component:

defmodule ChatWeb.ChatLive.HTML do
  use ChatNative, [:render_component, format: :html]
end

Very weirdly it's interpreted as text. (see the image below)

Screenshot 2024-08-23 at 11 50 24 AM
bcardarella commented 3 weeks ago

@BrooklinJazz are you using ~H or ~LVN ?

BrooklinJazz commented 3 weeks ago

For the render function, I'm using ~H

BrooklinJazz commented 3 weeks ago

But in the example, I'm using a separate template file