Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple form not valid inside of html template. #3

Open
BrooklinJazz opened this issue Aug 23, 2024 · 5 comments
Open

Simple form not valid inside of html template. #3

BrooklinJazz opened this issue Aug 23, 2024 · 5 comments
Assignees

Comments

@BrooklinJazz
Copy link

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
Copy link
Contributor

@BrooklinJazz are you using ~H or ~LVN ?

@BrooklinJazz
Copy link
Author

For the render function, I'm using ~H

@BrooklinJazz
Copy link
Author

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

@trentjones21
Copy link

@BrooklinJazz Did you ever figure this out? I'm having the same issue when using a template file. Seems to work in a render/2 function but just prints out the HTML as text in a template file.

@bcardarella bcardarella self-assigned this Nov 11, 2024
@bcardarella
Copy link
Contributor

The issue is related to the Native module. I've got a local working branch to fix this but I'm currently in the middle of implementing LiveComponents in LVN and will circle back to resolve this problem after. Sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants