Changes to Rails scaffold views required for XHTML strict validation

Rails 1.1.6

My test application uses instance variables called @account and @account_pages, so for every occurrence of these in the examples below, change them to whichever are applicable to your application.

The changes are given as diffs.

list.rhtml

Must have a block-level element around the 'new' link.

@@ -22,6 +22,4 @@
 <%= link_to 'Previous page', { :page => @account_pages.current.previous } if @account_pages.current.previous %>
 <%= link_to 'Next page', { :page => @account_pages.current.next } if @account_pages.current.next %> 
 
-<br />
-
-<%= link_to 'New account', :action => 'new' %>
+<p><%= link_to 'New account', :action => 'new' %></p>

new.rhtml

Must have a block-level element around the submit button and the 'back' link.

@@ -2,7 +2,7 @@
 
 <%= start_form_tag :action => 'create' %>
   <%= render :partial => 'form' %>
-  <%= submit_tag "Create" %>
+  <p><%= submit_tag "Create" %></p>
 <%= end_form_tag %>
 
-<%= link_to 'Back', :action => 'list' %>
+<p><%= link_to 'Back', :action => 'list' %></p>

edit.rhtml

Must have a block-level element around the submit button and the 'show'/'back' links.

@@ -2,8 +2,9 @@
 
 <%= start_form_tag :action => 'update', :id => @account %>
   <%= render :partial => 'form' %>
-  <%= submit_tag 'Edit' %>
+  <p><%= submit_tag 'Edit' %></p>
 <%= end_form_tag %>
-
+<p>
 <%= link_to 'Show', :action => 'show', :id => @account %> |
 <%= link_to 'Back', :action => 'list' %>
+</p>

show.rhtml

Must have a block-level element around the 'edit'/'back' links.

@@ -4,5 +4,7 @@
 </p>
 <% end %>
 
+<p>
 <%= link_to 'Edit', :action => 'edit', :id => @account %> |
 <%= link_to 'Back', :action => 'list' %>
+</p>

Last modified: 18/04/2007 Tags: (none)

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top