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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:04:05+00:00 2026-05-10T15:04:05+00:00

When using a Zend_Form , the only way to validate that an input is

  • 0

When using a Zend_Form, the only way to validate that an input is not left blank is to do

$element->setRequired(true); 

If this is not set and the element is blank, it appears to me that validation is not run on the element.

If I do use setRequired(), the element is automatically given the standard NotEmpty validator. The thing is that the error message with this validator sucks, ‘Value is empty, but a non-empty value is required’. I want to change this message. At the moment I have done this by changing the Zend_Validate_NotEmpty class, but this is a bit hacky.

I would ideally like to be able to use my own class (derived from Zend_Validate_NotEmpty) to perform the not empty check.

  • 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. 2026-05-10T15:04:05+00:00Added an answer on May 10, 2026 at 3:04 pm

    I did it this way (ZF 1.5):

    $name = new Zend_Form_Element_Text('name'); $name->setLabel('Full Name: ')      ->setRequired(true)      ->addFilter('StripTags')      ->addFilter('StringTrim')      ->addValidator($MyNotEmpty); 

    so, the addValidator() is the interesting part. The Message is set in an ‘Errormessage File’ (to bundle all custom messages in one file):

    $MyNotEmpty = new Zend_Validate_NotEmpty(); $MyNotEmpty->setMessage($trans->translate('err.IS_EMPTY'),Zend_Validate_NotEmpty::IS_EMPTY); 

    hope this helps…

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Should be in Users\\Documents It might be in a subdirectory… May 11, 2026 at 9:38 am
  • added an answer One of your comments betrays that you are not using… May 11, 2026 at 9:38 am
  • added an answer That's the focusing border added by the browser. For usability… May 11, 2026 at 9:38 am

Related Questions

When using a Zend_Form , the only way to validate that an input is
When using a DataReader object to access data from a database (such as SQL
When using a browser to transform XML (Google Chrome or IE7) is it possible
When using a file attachment control on a InfoPath form as part of a
When using a Silverlight-enabled WCF service, where is the best place to instantiate the
When using a Random Number Generator, which is the better way to use it
When using a thread pool and its queuecallbackitem, can I not pass in a
When using a SortedDictionary in Linq and iterating over the KeyValuePair it provides, can
Specifically this is regarding when using a client session cookie to identify a session
By default when using a webapp server in Eclipse Web Tools, the server startup

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.