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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:01:24+00:00 2026-06-01T09:01:24+00:00

I have text box in which your adds values in comma separated values. Once

  • 0

I have text box in which your adds values in comma separated values. Once the form is post I want to check each of CSV value against database table that if each one of them exist already. If so then I want to throw error message otherwise that is fine.

How can I implement 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-01T09:01:26+00:00Added an answer on June 1, 2026 at 9:01 am

    What you need is a custom validator. you can either do it extending Zend_Validate_Abstract or you can simply use a callback validator.

    To do so, you need to add this to your element:

    $elem = new Zend_Form_Element_Text('elem_name');
    $elem->setLabel('Label Name:')
             ->setRequired(true)
             ->addValidator('callback', true, array('callback' => array($this, 'functionName')));
    $this->addElement($elem);
    

    And in the same class (usually your form is in a class that extends Zend_Form), you add this method:

    public function functionName($csvString) {
        // stuff here using explode(',', $csvString)
        // foreach() to iterate over the result and match against the db each $value
    }
    

    See explode() for more information.

    However, if your form element is going to be called more than once, and in different forms, then I don’t recommend you to use a callback, but you’d better write your own validator, the theory remains the same though. Take a look here for more information about how to write validators.

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

Sidebar

Related Questions

I have a form in which i have a text box for email and
I have a text box which has a Ajax calendar extender attached. You click
Lets say I have a text box which should have a default value.... and
I have a web page with a read-only text box which shows some HTML
I have a program which has a text box that the user can edit.
I have an ASP page which displays a text box when it loads. It
I have this html page which is very simple, it contains a text box
I have a label next to a text box which has a short cut
I have a form which the client wants the labels inside the input box
I have a an input box on my homepage which i want users to

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.