Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8314173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:44:00+00:00 2026-06-08T20:44:00+00:00

I have a form that creates a new entry into a database. One of

  • 0

I have a form that creates a new entry into a database. One of the fields uses jquery Datepicker. At the moment, I can pick a date using the UI calendar and it displays in the right format in the textbox, but when I submit the form, the format changes back to the default setting, and saves in the database. I have had this working before on a older version of my site, and I tried following questions already posted, but had no luck. Hopefully someone can see the problem. Thanks.

Here’s part of my Project Controller:

def create

    @project = Project.new(params[:project])


    @project.client = params[:new_client] unless params[:new_client].blank?
    @project.exception_pm = params[:new_exception_pm] unless params[:new_exception_pm].blank?
    @project.project_owner = params[:new_project_owner] unless params[:new_project_owner].blank?
    @project.role = params[:new_role] unless params[:new_role].blank?
    @project.industry = params[:new_industry] unless params[:new_industry].blank?
    @project.business_div = params[:new_business_div] unless params[:new_business_div].blank?

    respond_to do |format|
      if @project.save
        format.html { redirect_to @project, notice: 'Project was successfully created.' }
        format.json { render json: @project, status: :created, location: @project }
      else
        format.html { render action: "new" }
        format.json { render json: @project.errors, status: :unprocessable_entity }
      end
    end
  end

Here’s part of my form view:

<%= form_for(@project) do |f| %>


  <% if @project.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@project.errors.count, "error") %> prohibited this project from being saved:</h2>

      <ul>
      <% @project.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>


   <div class="field">
    <%= f.label :start_date %><br />
    <%= f.text_field :start_date, :class => 'datepicker' %>
  </div>

<div class="field">
    <%= f.label :end_date %><br />
    <%= f.text_field :end_date, :class => 'datepicker' %>
  </div>



  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

Here’s my application.js file:

$(function() {
  $("#project_start_date").datepicker({dateFormat: 'dd-mm-yy'});
});

$(function() {
  $("#project_end_date").datepicker({dateFormat: 'dd-mm-yy'});
});

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T20:44:02+00:00Added an answer on June 8, 2026 at 8:44 pm

    This probably has nothing to do with the saving of the date, but with the display of the date. Dates are stored in the database as dates, not strings, so when you view the date, it is shown as the default output format after rails converts the type.

    In your view, you need to format it with strftime or possibly use I18N routines

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this JS form that creates a new record ( MySQL ,
I have a win form that creates a site in IIS7. One function needs
I have a form that uses ajax to submit data to a mysql database,
I have an MDI parent form that creates many MDI children at run time.
I have created a form that contains fields used to accept a floating value
I have a web form that uses if statements to create a string of
I have a button that will create a new entry (row in a table)
I wrote a form based program in C# that uses MS access database to
I have a form that submits data to a database in a CodeIgniter app
I have a WinForms data entry form that will have upwards of 1500 questions.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.