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 824341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:05:17+00:00 2026-05-15T03:05:17+00:00

Notice the following result when I submit blank :title and :description fields Error div

  • 0

Notice the following result when I submit blank :title and :description fields

Error div tags only wraps the title text field and not the description text area. http://www.freeimagehosting.net/uploads/c14b4a2d74.png

The validations are in the controller:

class Question < ActiveRecord::Base
  validates_presence_of :title
  validates_presence_of :description

And, the form is generated with those names:

-form_for(@question) do |f|
  = f.error_messages
  = f.label :title
  = f.text_field :title, :size => 50, :onchange => remote_function(:url => {:action => :display_tag_suggestions}, :with => 'Form.Element.serialize(this)')
  #suggestions
  = f.label :description
  = f.text_area :description
  ...

But, for some reason, only :title gets wrapped in the error div tags:

<form action="/questions" class="new_question" id="new_question" method="post">
  <div style="margin:0;padding:0"><input name="authenticity_token" type="hidden" value="6HQaiu1D0gBQcKw2pLeZP6Jvn0FSClPD5Sk9HwegzPg=" /></div>
  <div class="errorExplanation" id="errorExplanation">
    <h2>2 errors prohibited this question from being saved</h2>
    <p>There were problems with the following fields:</p>
    <ul>
      <li>Title can't be blank</li>
      <li>Description can't be blank</li>
    </ul>
  </div>
  <label for="question_title">Title</label>
  <div class="fieldWithErrors"><input id="question_title" name="question[title]" onchange="new Ajax.Request('/questions/display_tag_suggestions', {asynchronous:true, evalScripts:true, parameters:Form.Element.serialize(this) + '&amp;authenticity_token=' + encodeURIComponent('6HQaiu1D0gBQcKw2pLeZP6Jvn0FSClPD5Sk9HwegzPg=')})" size="50" type="text" value="" /></div>
  <label for="question_description">Description</label>
  <textarea cols="40" id="question_description" name="question[description]" rows="20"></textarea>
  ...

I don’t think that behavior is expected. The problem most people have is that it’s wrapping things with divs, which won’t display properly. My problem is that fields aren’t being wrapped with divs to begin with!

I haven’t made any (conscious) changes to how errors are handled, so I’m not sure why it’s not working properly.

  • 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-05-15T03:05:18+00:00Added an answer on May 15, 2026 at 3:05 am

    What version of Haml are you using? Some older versions had compatibility trouble with error wrapping.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 406k
  • Answers 406k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Every message to a gen_server process other than a call,… May 15, 2026 at 6:01 am
  • Editorial Team
    Editorial Team added an answer You are mixing up client and server side code. In… May 15, 2026 at 6:01 am
  • Editorial Team
    Editorial Team added an answer The prefix for all your hooks should be the name… May 15, 2026 at 6:01 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.