Add required to form fields

This commit is contained in:
Trevor Vallender 2024-05-29 08:24:21 +01:00
parent 3881248603
commit 5116a9d031
5 changed files with 11 additions and 10 deletions

View File

@ -1,8 +1,8 @@
<% # locals: (game_system: @game_system, button_text:, url:) %> <%# locals: (game_system: @game_system, button_text:, url:) %>
<%= form_with model: @game_system, url: do |f| %> <%= form_with model: @game_system, url: do |f| %>
<%= f.label :name %> <%= f.label :name %>
<%= f.text_field :name %> <%= f.text_field :name, required: true %>
<%= f.submit button_text %> <%= f.submit button_text %>
<% end %> <% end %>

View File

@ -5,10 +5,10 @@
<section class="inset"> <section class="inset">
<%= form_with url: sessions_path do |f| %> <%= form_with url: sessions_path do |f| %>
<%= f.label :username %> <%= f.label :username %>
<%= f.text_field :username %> <%= f.text_field :username, required: true %>
<%= f.label :password %> <%= f.label :password %>
<%= f.password_field :password %> <%= f.password_field :password, required: true %>
<%= f.submit t(".log_in") %> <%= f.submit t(".log_in") %>
<% end %> <% end %>

View File

@ -2,10 +2,10 @@
<%= form_with model: @table do |f| %> <%= form_with model: @table do |f| %>
<%= f.label :name %> <%= f.label :name %>
<%= f.text_field :name %> <%= f.text_field :name, required: true %>
<%= f.label :game_system_id %> <%= f.label :game_system_id %>
<%= f.collection_select :game_system_id, GameSystem.all, :id, :name %> <%= f.collection_select :game_system_id, GameSystem.all, :id, :name, required: true %>
<%= f.submit button_text %> <%= f.submit button_text %>
<% end %> <% end %>

View File

@ -3,7 +3,7 @@
<section class="inset"> <section class="inset">
<%= form_with model: user do |f| %> <%= form_with model: user do |f| %>
<%= f.label :username %> <%= f.label :username %>
<%= f.text_field :username %> <%= f.text_field :username, required: true %>
<%= f.label :first_name %> <%= f.label :first_name %>
<%= f.text_field :first_name %> <%= f.text_field :first_name %>
@ -12,13 +12,13 @@
<%= f.text_field :last_name %> <%= f.text_field :last_name %>
<%= f.label :email %> <%= f.label :email %>
<%= f.text_field :email %> <%= f.text_field :email, required: true %>
<%= f.label :password %> <%= f.label :password %>
<%= f.password_field :password %> <%= f.password_field :password, required: true %>
<%= f.label :password_confirmation %> <%= f.label :password_confirmation %>
<%= f.password_field :password_confirmation %> <%= f.password_field :password_confirmation, required: true %>
<%= f.submit button_text %> <%= f.submit button_text %>
<% end %> <% end %>

View File

@ -1,4 +1,5 @@
- Ensure form errors/flash show correctly - Ensure form errors/flash show correctly
- Add players to tables - Add players to tables
- notifications
- Add characters to users/tables - Add characters to users/tables
- Character sheets/prototypes - Character sheets/prototypes