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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:03:18+00:00 2026-06-10T21:03:18+00:00

I need to validate a field as a Zip code and I want to

  • 0

I need to validate a field as a Zip code and I want to use the FormItem-getter that was generated for the table I’m building a form for. There’s no “GetZipCodeZipFormItem” FormItem getter being generated but I’ve noticed you can validate a Zip code with the Validator class. I would just add it manually with the my DataModification but I don’t have a reference to the PostBackValueDictionary needed to get the value from the FormItem‘s control.

How can I validate this FormItem as a Zip code?

  • 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-10T21:03:20+00:00Added an answer on June 10, 2026 at 9:03 pm

    Assuming yourModObject.ZipCode is a string:

    yourModObject.GetZipCodeFormItem(
        true,
        ( value, label ) => new EwfTextBox( value ),
        ( control, pbv, subject, validator ) =>
            validator.GetZipCode( new ValidationErrorHandler( subject ),
                                  control.GetPostBackValue( pbv ),
                                  true ).FullZipCode,
        value: "",
        validationList: yourDataModification )
    

    Another way to do it is:

    yourModObject.GetZipCodeTextFormItem(
        true,
        true, // allow empty
        value: "",
        additionalValidationMethod: ( subject, validator ) =>
            yourModObject.ZipCode = validator.GetZipCode( new ValidationErrorHandler( subject ),
                                                          yourModObject.ZipCode,
                                                          true ).FullZipCode,
        validationList: yourDataModification )
    

    One drawback to the second approach is that the primary validation (i.e. the logic that stores a value in the mod object) is not aware that it’s a ZIP Code that is being entered, so if, for example, your database field had a limit of nine characters (to accommodate a ZIP+4) and the user entered “12345-1234”, primary validation would fail because the dash pushes the string over the length limit. You wouldn’t even get to the additional validation method. This problem doesn’t exist with the first approach.

    • 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 phone number field, i need to validate it with
I need to validate the text box value from the generated html table (grid)
Using javascript I need to validate a form field containing a date in the
I need to validate a form. This is some server side validation that checks
Yup, basically, I am building a web form that need to provide different required
I need to validate a form textfield that's bound to a property of a
I have a form that uses the validation plugin, but I need to validate
I need to validate a date/time field on a webpage but want it to
I need to validate submitted form data: To check whether fields are empty. Proceed
I need to validate a form with a bunch of inputs in it. And,

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.