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

The Archive Base Latest Questions

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

In Zend_Form i want to validate for duplicate records that might exist in database.

  • 0

In Zend_Form i want to validate for duplicate records that might exist in database. since i am using doctrine 1.2.4 i am using custom validator.

i defined a custom validator class Application_Validator_NoRecordExists extends Zend_Validate_Abstract which sits in application/validator directory.

the class definition is taken from

Zend_Validate: Db_NoRecordExists with Doctrine

what i am confused about is how to use the validator in my forms for example i want to validate the email address to check wether duplicate record exist with the custom validator class.

class Application_Form_User extends Zend_Form
{
    public function init()
    {
        $this->setAction('/admin/user/create/')
             ->setMethod('post');

        $email = new Zend_Form_Element_Text('email');
        $email->setLabel('Email address:')
              ->setOptions(array('size' => 50))
              ->setRequired(true)
              ->addValidator('EmailAddress', true)
              ->addFilter('HTMLEntities')
              ->addFilter('StringToLower')
              ->addFilter('StringTrim');

        //add element to form
    }
}

how do i do it?

  • 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-31T18:17:27+00:00Added an answer on May 31, 2026 at 6:17 pm

    You have to add a prefix path to your form, in order for your class to be recognized.

    Zend_Form::addPrefixPath(string $prefix, string $path, string $type = null)
    

    The following passage from the reference manual should make it clear: http://framework.zend.com/manual/1.11/en/zend.form.elements.html#zend.form.elements.validators

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

Sidebar

Related Questions

When using a Zend_Form , the only way to validate that an input is
How do I tell the Zend_Form that I want an element (and it's ID-label,
I am using an XML config file to tell Zend_Form what elements I want.
I'm writing a custom validator that checks that at least one field has a
I want to validate a form element that is allowed to contain multiple email
Hello there i'm trying to create a form with Zend_Form that will enable my
say i want to attach errors to my Zend_Form i found out the default
the result i want is a textarea that hooks up to WMD (markdown editor).
I want to use Zend_Form because of its validation and filters etc. But the
I'm using Zend_Form to create forms and I have an issue with the setLabel-function.

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.