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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:03:29+00:00 2026-05-21T12:03:29+00:00

I have a Presenter that is used for user registration and I need to

  • 0

I have a Presenter that is used for user registration and I need to implement validation errors on it, what I’ve done is I created a method for each validation error, like UserCannotBeEmpty(), InvalidEmailAddress(), UserAlreadyExists() and so on…

It is ok for just a few fields, but it just doesn’t look good if I have a lot of fields, I would have to create a lot of methods for that…

What’t the best way to do this?

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-21T12:03:30+00:00Added an answer on May 21, 2026 at 12:03 pm

    What’s wrong with more fields – more validation? If you have 20 different fields to check, and each one requires different type of validation, you’ll have to implement that many methods.

    Sure, there are some common ways to help you here. You probably don’t need UserCannotBeEmpty and PasswordCannotBeEmpty methods. Most likely you’ll be fine with CannotBeEmpty(string errorMessage). Refactor out stuff that’s common (null checks, alphanumeric checks, datetime/number parsing and so forth – type dependant), and implement field-specific validation only when needed.

    Keep in mind, domain specific validation (your business rules, eg. “shipment date cannot occur before production date”) should be validated on model-side.

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

Sidebar

Related Questions

In my rails project I have a presenter method that has a helper view
I need to be able to set a MySQL user variable that is used
I have a ListView and the idea is that when the user types than
I need to implement a chat system for a website, so that customers of
I have a view that's used to display Comments. You can obviously comment from
I have a grouped table view that contains 3 sections and each row per
We have an unattended app w/o a user interface that is is periodically run.
I have a view that is used to update some NSUserDefaults. These defaults have
I have a UITableView that displays images associated with contacts in each row. In
Basically, I have a page that contains a form. When a user submits 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.