Click here to Skip to main content
15,891,976 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am currently developing a web application using Ruby on Rails. I have a table for workers and a table for grades. When a new worker is added to the system the form looks as follows:

XML
<h1>New worker</h1>

<% form_for(@worker) do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.label :name %><br />
    <%= f.text_field :name %>
  </p>
  <p>
    <%= f.label :grade %><br />
    <%= f.text_field :grade %>
  </p>
  <p>
    <%= f.label :remaining_days %><br />
    <%= f.text_field :remaining_days %>
  </p>
  <p>
    <%= f.submit 'Create' %>
  </p>
<% end %>

<%= link_to 'Back', workers_path %>


My grades table contains two columns which are grade and no_of_days.

When a new worker is being added, I need the no_of_days to be added automatically depending on the grade selected.
Posted

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900