bootstrap-ruby / bootstrap_form

Official repository of the bootstrap_form gem, a Rails form builder that makes it super easy to create beautiful-looking forms using Bootstrap 5.
MIT License
1.64k stars 352 forks source link

Need to use plain method for visibility with bootstrap_form in Phlex Component #723

Closed aydinkazim closed 4 months ago

aydinkazim commented 4 months ago

I'm developing an interface with Phlex component using Ruby on Rails, and I'm using the bootstrap_form gem for forms. However, I'm facing an issue where the fields created with f.text_field(:company_name) are not visible unless I wrap them with plain method. Here is an example of the code:

div(class: 'modal-body') do
  helpers.bootstrap_form_with(model: @new_user, url: b2b_sessions_path, local: true) do |f|
    plain(f.text_field(:company_name))
    plain(f.text_field(:name))
    plain(f.text_field(:surname))
    # Other fields...
  end
end

Without the use of plain, the fields fail to render on the interface. I am seeking assistance to understand the underlying cause of this behavior. Is there a specific reason for this, or am I possibly misusing the gem? Additionally, if there's a workaround available for this issue, I would greatly appreciate any guidance.

lcreid commented 4 months ago

Hi, @aydinkazim . Thanks for the report. What was the solution to your issue?

aydinkazim commented 4 months ago

Hi @lcreid, Just added these two lines:

include Phlex::Rails::Helpers::FormWith
include BootstrapForm::ActionViewExtensions::FormHelper

With these changes, the form fields started rendering correctly 🙌