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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:19:12+00:00 2026-05-22T17:19:12+00:00

I have a drop down Element_Select that I’m turning into a custom element Element_SelectCustom

  • 0

I have a drop down Element_Select that I’m turning into a custom element Element_SelectCustom so that I can populate it with values directly. This is the custom element

<?php

require_once ('Zend/Form/Element/Select.php');

class Zend_Form_Element_SelectCustom extends Zend_Form_Element_Select
{
    public function init() {
        $this->addMultiOptions(array(
            'NULL' => 'Choose Value',
            '1' => 'First',
            '2' => 'Second',
            '3' => 'Third',
        ));
        return parent::init();
    }

The problem is that when I add the new custom element to the form and set it to required, it doesn’t fire an error when I don’t choose a value.

$test = new Zend_Form_Element_SelectCustom('test');
$test->setRequired(true);
$this->addElement($test);

I have no idea what’s wrong with it. Is there maybe another method that I need to re-initiate?

  • 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-22T17:19:13+00:00Added an answer on May 22, 2026 at 5:19 pm

    You have to change 'NULL' to NULL. The first is a string with the content “NULL” the latter a empty value. An empty string '' should be also fine.

    public function init()
    {
        $this->addMultiOptions(array(
            NULL => 'Choose Value', // '' => 'Choose Value'
            '1' => 'First',
            '2' => 'Second',
            '3' => 'Third',
        ));
        return parent::init();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a drop-down list with known values. What I'm trying to do is
I have a drop down list where users can select a theme for the
I have a drop down list that has options that need to be passed
I have a drop down list that triggers an updatepanel when the index is
This would be my issue I have a drop down that's not displaying fully.
Currently, I have two drop down lists that are populated with users' first and
I have a drop down box next to html link tag element, the link
I have a category select that then loads up sub categories into a drop
I have an existing drop down menu that I am attempting to convert to
I'm trying to modify a name-related element. I'm taking values from a drop-down 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.