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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:14:34+00:00 2026-06-03T11:14:34+00:00

Our registration and login forms require server-side validation logic. I’d like to come up

  • 0

Our registration and login forms require server-side validation logic. I’d like to come up with the best way of displaying messages for each input block on the client.

The application flow:

  1. Client side form submit
  2. Validation on node
  3. Redirect to the view that rendered the form in step 1.

I’m leaning toward req.flash() to display form input messages but perhaps there is a more OOP approach to this?

  • 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-03T11:14:35+00:00Added an answer on June 3, 2026 at 11:14 am

    I have a validation middleware that will validate form data. I can tell the middleware what form to rerender if validation fails and it will have an errors object with the name of the field and an array of errors that field has.

    My forms end up looking like this:

    include ../mixins/form-helpers
    
    mixin errors()
    
    form(action=url('messages_create'), method='post')
    
      mixin csrf()
    
      fieldset
    
        legend contact
    
        mixin field('text', 'subject', 'Subject')
        mixin field('textarea', 'message', 'Message')
    
      .form-actions
        mixin submit('Send')
    

    If I post this form without subject and message I set the following object.

    var errors = { subject: ['is required'], message: ['is required'] };
    

    My errors mixin will render all the errors and my field mixin will add an error class so I can add a red border to my failing fields.

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

Sidebar

Related Questions

I deployed my MVC application in our IIS server. When I go to registration
We have a website we would like to transfer to our Server 2008, IIS7
We have a simple registration form for our website users where we only require
we use super-long Hashes for the Registration of new Users in our Application. The
I'm trying to deploy my new ASP.NET MVC 2.0 website to our Windows Server
When our Registration ID (given by the C2DM) refreshed, do we get a notification
I had a weird problem, our website has registration form coded using zend form,
Our client wants to add an 'Industry' dropdown to customer registration. We have created
We are currently introducing facebook and twitter login functionality for our users both on
When I save the information from a registration form I have some validation rules

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.