Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

106
Views
Rails Form input_html not working for calling javascipt controller

So I have this input field, using form Rails 7.0.2.3, and I'm looking forward to call a controller but this is not connecting.

<%= form_with url: "/projects/#{@project.id}", method: :get do |form| %>
   <%= form.text_field :query, html5: true, input_html: { data: { controller: "flatpickr" } } %>
   <%= form.submit '๐Ÿ”Ž', class: 'button' %>
<% end %>

If I put in the next way, it works, but I need it to be in the input field. I'm guessing the problem is with input_html tag

<%= form_with url: "/projects/#{@project.id}", method: :get do |form| %>
   <div data-controller="flatpickr">
     <%= form.text_field :query %>
   </div>
   <%= form.submit '๐Ÿ”Ž', class: 'button' %>
<% end %>
about 4 years ago ยท Juan Pablo Isaza
1 answers
Answer question

0

For text_field write just

<%= form.text_field :query, html5: true, data: { controller: "flatpickr" } %>

Without input_html

about 4 years ago ยท Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
ยฉ 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!