'Rails jquery datepicker in form_tag for search form
For Forms which updates models my datepicker is working and included as follows:
= f.input :starts_at, :as => :datepicker
now I want to use the Datepicker in a Search Form which passes several search params to the controller (not using a model). I'm no sure how the input is defined with text_field_tag or else.
= form_tag some_action_path, method: "get", class: "someclass" do |f|
= text_field_tag ???...
Solution 1:[1]
found the solution, i simply have to pass the paramname as id to the datepicker js
= text_field_tag :starts_at
:javascript
$(function() {
$( "#starts_at" ).datepicker();
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jethroo |
