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

  • Home
  • SEARCH
  • 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 6794511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:13:51+00:00 2026-05-26T18:13:51+00:00

The following validation code in the model: validates :formatted_address, :zip, :city, :state, :country, :presence

  • 0

The following validation code in the model:

validates :formatted_address, :zip, :city, :state, :country, :presence => true, :message => "is incomplete. Please enter full address."

is displayed when either of the fields are empty. Let’s say now :address and country are empty, 2 errors are displayed:

Formatted Address is incomplete. Please enter full address.
Country is incomplete. Please enter full address.

How can I group the error message in the validation to just show one error message if either of the fields validated does not exist?

Address is incomplete. Please enter full address.

Thanks.

  • 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-26T18:13:51+00:00Added an answer on May 26, 2026 at 6:13 pm

    You could just write your own validator using the validate macro:

    validate :has_complete_address
    
    #...
    
    private
    def has_complete_address
        # Check that everything is there and
        # call self.errors.add to store an error
        # message if something is wrong.
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code to enable validation work: $(document).ready(function() { $(#eventForm).validate({ rules: {
Where is the proper place to perform validation given the following scenario/code below: In
I'm working with the jQuery Validation plugin and I wrote the following code which
I have the following validation in a model: validates_length_of :description, :minimum => 2, :on
The following code creates a form based on a model, Post . Problem I
Given the following models (cut down for understanding): class Venue(models.Model): name = models.CharField(unique=True) class
Does anyone know of a solution to the following markup validation error? I'm not
I'm trying to implement XOR in javascript in the following way: // XOR validation
The following questions are about XML serialization/deserialization and schema validation for a .net library
I have the following classes defined to do validation: public class DefValidator : IValidate<IDef>

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.