Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

286
Visualizações
Bootstrap datepicker, autofill to and disable typing on select date

Rails datepicker Autofil to field with 10 days from the selected date on from field

$('.datepicker').datepicker({format: "yyyy/mm/dd"})

<div class="bg-body-light mb-3 ">
<%= form_tag profile_path, method: "get" do |f| %>
    <%= hidden_field :daily, :value => true %>
        <div class="fields"> 
                <div class="form-row align-items-center  m-3  pt-3">
                    <div class="col-auto"> 
                        <p>   
                            <strong><%= I18n.t 'profile.form.from' %></strong>  
                            <%= text_field 'from',nil, class: 'form-control datepicker',placeholder: (I18n.t 'profile.form.from')  %>
                        </p>

                    </div>  
                    <div class="col-auto"> 
                        <p>   
                            <strong><%= I18n.t 'profile.form.to' %></strong>  
                            <%= text_field 'to',nil, class: 'form-control datepicker',placeholder: (I18n.t 'profile.form.to')  %>
                        </p>

                    </div>  
                    <div class="col-auto"> 
                            <%= button_tag( class: "btn btn-sm btn-outline-primary btn-rounded search-button-style") do %>
                                    <i class="fa fa-search"></i>
                                    <span><%= I18n.t 'search' %><span>
                            <% end %>
                    </div>
                </div>  
        </div>  
<% end %>

I have added a datepicker field on rails view. (from and to fields). This is my form. I want the to field automatically filled once I select the date on from field with 10 days later.from=(2020/01/20) then to field to be auto to(2020/01/30). Also I donot want to use date-select, because i need it in same design that It is now, but Can I disable the input field with only select the datepicker but no typing of any string?

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda