First of all I'm new to the HTML and RAILS coding. But as a part of learning experience, I've designed a machine reservation system for the lab I'm working in. I've a form (show.html.erb) to view a machine details like name, ipaddress etc. below that there is a reservation form with datetime_select, number of hours option as shown below,
As you can see it's really basic html coding.
...
Machine details
Name: <%= @machine.name %>
Ipaddress: <%= @machine.ipaddress %>
Processor: <%= @machine.processor %>
Memory: <%= @machine.memory %>
Operating System: <%= @machine.os %>
Description: <%= @machine.description %>
Machine status:
<% if @machine.active == true %>
Online
<% else %>
Offline
<% end %>
<% if @machine.can_reserved == false %>
This machine can not be reserved. See description
<% end %>
<fieldset>
<legend>Create a New Reservation</legend>
<p style="color: red"><%= flash[:error] %></p>
<%= form_for [@machine, @reservation] do |f| %>
<div class="field">
<%= f.label :startdate, 'Start Time' %>:
<%= f.datetime_select :startdate %> (<b>PST</b> timezone)
</div>
<div class="field">
<%= f.label :purpose, 'Reason' %>:
<%= f.text_field :purpose, :size => 40 %>
</div>
<div class="field">
<%= f.label :hour, 'Hour(s)' %>:
<%= f.text_field :hour, :size => 2 %>
</div>
<div class="field">
<%= f.label :days, 'No of Days' %>:
<%= f.text_field :days, :size => 2 %>
</div>
<div class="actions">
<%= f.submit 'Reserve this machine' %>
</div>
<% end %>
<br />
</fieldset>
... Now when you clicks show action for a machine, it does everything right. Shows all Machine details, and show current time in the reservation form. But as I refresh the page after let's say a minute, it refreshes machine details info but it doesn't (refresh) change the time already shown with the datetime_select option. Why? How can it always show current time? I understand the views are nothing but a static pages. I added tag to the page which again refreshes the whole page automatically but doesn't seem to affect date shown in the datetime_select option.
Any thoughts? I really appreciate the help.
Thanks.
Tom