Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9244709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:06:09+00:00 2026-06-18T09:06:09+00:00

I have the following two _forms: user form <%= simple_form_for(@user, :url => @target) do

  • 0

I have the following two _forms:

user form

<%= simple_form_for(@user, :url => @target) do |f| %>
  <% if @user.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
      <ul>
      <% @user.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <%= f.input :email, :label => "User Email" %>
  <%= f.input :password, :label => "User Password" %>
  <%= f.input :first_name %>
  <%= f.input :last_name %>
  <%= f.button :submit %>
<% end %>

tenant form

<%= simple_form_for(@tenant, :url => @target) do |f| %>
  <% if @tenant.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@tenant.errors.count, "error") %> prohibited this tenant from being saved:</h2>

      <ul>
      <% @tenant.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <%= f.input :name, :label => 'Name', :required => true %>
  <%= f.input :billing_email, :label => 'Email', :required => true %>
  <%= f.input :country, :label => 'Country', :required => true %>
  <%= f.button :submit %>
<% end %>

I have come across the following post from stackoverflow f.error_messages in Rails 3.0

Here there is method so that error messages can be returned from the simple form by using f.error_messages but I have been unable to get this working as I am unsure whereabout this method should be saved. Anyone got any hints? The method is as follows:

class StandardBuilder < ActionView::Helpers::FormBuilder
  def error_messages
    return unless object.respond_to?(:errors) && object.errors.any?

    errors_list = ""
    errors_list << @template.content_tag(:span, "There are errors!", :class => "title-error")
    errors_list << object.errors.full_messages.map { |message| @template.content_tag(:li, message) }.join("\n")

    @template.content_tag(:ul, errors_list.html_safe, :class => "error-recap round-border")
  end
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:06:10+00:00Added an answer on June 18, 2026 at 9:06 am

    Just add error: false to your inputs this will not clear the css but will clear the inline errors

    f.input error: false
    

    Edit:

    From http://ruby.railstutorial.org/book/ruby-on-rails-tutorial

    /app/views/shared/_error_messages.html.erb

    <% if object.errors.any? %>
        <div id="error_explanation">
            <div class="alert alert-error">
                The form contains <%= pluralize(object.errors.count, "error") %>.
            </div>
            <ul>
                <% object.errors.full_messages.each do |msg| %>
                  <li>* <%= msg %></li>
                <% end %>
            </ul>
        </div>
    <% end %>
    

    in VIEW

    <%= form_for(@user) do |f| %>
      <%= render 'shared/error_messages', object: f.object %>
    
      <%= f.label :name %>
      <%= f.text_field :name %>
    
      <%= f.label :email %>
      <%= f.text_field :email %>
    
      <%= f.label :password %>
      <%= f.password_field :password %>
    
      <%= f.label :password_confirmation, "Confirmation" %>
      <%= f.password_field :password_confirmation %>
    
      <%= f.submit "Create my account", class: "btn btn-large btn-primary" %>
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with (at least) the following two fields: country club The
i have two text inputs like the following, i don't want to use <form>
How to wrap one div around another? I have following two div ids: #course
I have the following two simple models for users and user groups: class User
I am trying to do the following. Have two forms on page, [ form
I have a form which has two inputs. The first input allows a user
if i have a form with the following two elements. <select name= size=5 id=reasons
I have the following sample code which contains two checkboxes. When the user hits
I have the following problem. I got two forms on my web page. On
I have following two arrays. I want the difference between these two arrays. That

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.