htmltwitter-bootstrapbest-in-place

How can I use best_in_place gem with Bootstrap Form controls?


I want to use the best_in_place gem with Bootstrap's form controls. I can't seem to be able to combine both.

My best_in_place snippet

<div class="form-control" >
   <dt><%= best_in_place @user, :email, :as => :textarea %></dt>
</div>

My Bootstrap snippet

<form>
   <div class="form-group">
     <label for="exampleFormControlInput1">Email address</label>
     <input type="email" class="form-control" id="exampleFormControlInput1" placeholder="name@example.com">
    </div>
</form>

https://getbootstrap.com/docs/4.0/components/forms/

enter image description here

https://github.com/bernat/best_in_place

enter image description here

Any ideas how this can be done?

This works with Validations

<form>
  <div class="form-group">
   <input type="email" class="form-control" >
  </div>
</form>

But using best_in_place, Bootstrap validations not working.

</form>
 <div class="form-control" input type="email" >
  <%= best_in_place @user, :email, :as => :input %>
 </div>
</form>

Solution

  • I ended up using this code

    </form>
     <div class="form-control" input type="email" >
      <%= best_in_place @user, :email, :as => :input %>
     </div>
    </form>
    

    But used another method (gem 'validates_email_format_of') to validate input, could not get both to work.