Please ask this question on the rubyonrails-talk group instead. This group is 
reserved for discussion about the core of Ruby on Rails (the framework itself) 
rather than applications built on it.

-- 
Ryan Bigg

On Friday, 4 February 2011 at 3:29 AM, mgj wrote: 
> Hi,
> 
> I am currently using Rails 2.0.2 with Ruby 1.8.7. My Prototoype.js
> version is 1.7(if required). I am basically trying to integrate the
> calendar_date_select plugin in my app.
> 
> The link/tutorial I am referring is: 
> http://ianli.com/site/HowTo/UseCalendarDateSelectRailsPlugin
> 
> I am trying to save the date I receive through the date select plugin
> and store in a rails symbol :publishing_date.
> 
> I am selecting the date using the calendar_date_select plugin. The
> selected date gets uploaded into the text field, but I am not sure how
> to transfer that returned value onto my publishing_date
> attribute(:publishing_date symbol) of my books table.
> 
> 
> On manually entering a date I am able to see it reflected in the DB. I
> am getting stuck when I am trying to save it through the plugin.
> 
> <%= f.text_field :publishing_date %>
> 
> On clicking on the create button I get a null value for the date
> selected via the calendar_date_select plugin. I am able to properly
> insert values for name of book and author.
> 
> My code for a new book looks like this:
> 
> <%= javascript_include_tag :defaults %>
> 
> 
> <script src='/javascripts/calendar_date_select/
> calendar_date_select.js' type='text/javascript'></script>
> 
> 
> <h1>New book</h1>
> 
> <%= error_messages_for :book %>
> 
> <% form_for(@book) do |f| %>
> <p>
> <b>Title</b><br />
> <%= f.text_field :title %>
> </p>
> 
> <p>
> <b>Author</b><br />
> <%= f.text_field :author %>
> </p>
> 
> 
> <p>
> <b>Publishing Date</b><br />
> 
> 
> <%=calendar_date_select_tag f.text_field :publishing_date %> <!--
> This way of save/assigning doesn't work -->
> 
> </p>
> 
> <br />
> <br />
> <br />
> <br />
> 
> <p>
> <%= f.submit "Create" %>
> </p>
> <% end %>
> 
> <%= link_to 'Back', books_path %>
> 
> 
> 
> 
> Also once I save it perfectly, could you also please tell me how would
> I be able to display this date it in my index.html.erb
> 
> My current index.html.erb looks like this:
> 
> <h1>Listing books</h1>
> 
> <table>
> <tr>
> <th>Title</th>
> <th>Author</th>
> <th>Publishing Date</th>
> </tr>
> 
> <% for book in @books %>
> <tr>
> <td><%=h book.title %></td>
> <td><%=h book.author %></td>
> <td><%= book.publishing_date %></td> <!-- Will this work? -->
> <td><%= link_to 'Show', book %></td>
> <td><%= link_to 'Edit', edit_book_path(book) %></td>
> <td><%= link_to 'Destroy', book, :confirm => 'Are you
> sure?', :method => :delete %></td>
> </tr>
> <% end %>
> </table>
> <%= will_paginate @books %>
> 
> <br />
> 
> <%= link_to 'New book', new_book_path %>
> 
> An interesting excerpt from the aforementioned tutorial link is given
> below:
> 
>  The value of the selected date can be accessed by getting the
> value of the text field named calendar.
> 
>  Using the Prototype Javascript Library, you can do the following
> to get the value.
> 
>  $F('calendar')
> 
> The roadblock I am facing is how to call the `$F('publishing_date')`
> in my new.html.erb file using the rails `<%=>` tag and then assign
> that to my :publishing_date symbol which will eventually be use to
> update the publishing_date attribute in my books table.
> 
> Thanks for your support.
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Core" group.
> To post to this group, send email to rubyonrails-core@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-core+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-core?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to