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

render problem #724

Open
Yasingthb opened this issue Feb 13, 2024 · 3 comments
Open

render problem #724

Yasingthb opened this issue Feb 13, 2024 · 3 comments

Comments

@Yasingthb
Copy link

Yasingthb commented Feb 13, 2024

The following code snippet provided in the documentation is not functioning as expected when used with Phlex framework:

f.email_field(:email, append: link_to("Go", "#", class: "btn btn-secondary"))
Instead of rendering the button correctly, it appears as a separate input element in the top right corner. However, when I use capture, it works correctly. Is this a known issue?

If I use capture it gives the result like this (f.email_field(:email, append: capture { link_to("Go", "#", class: "btn btn-secondary")}))

image

dont use capture (f.email_field(:email, append: link_to("Go", "#", class: "btn btn-secondary")))
image

@av-martin
Copy link

av-martin commented Feb 15, 2024

@Yasingthb it appears that Phlex immediately renders the html to the current context, where rails methods normally returns a string instead. So link_to(*args) in Phlex is equivalent to concat(link_to(*args)) in rails.

@Yasingthb
Copy link
Author

Thank you

@lcreid
Copy link
Contributor

lcreid commented Feb 28, 2024

Thanks for responding, @av-martin . @Yasingthb does this resolve your issue? It seems Phlex works in a way that isn't really compatible with how Rails and bootstrap_form work.

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