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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:40:05+00:00 2026-05-30T14:40:05+00:00

hi i created a zend multiselect box with several options. here is the code.

  • 0

hi i created a zend multiselect box with several options. here is the code.

$time = new Zend_Form_Element_Multiselect('time');
$time->setLabel('Select Your Notification Timings: ')
->setMultiOptions(
    array(
        '0' => "Select", 
        '00:00' => '00:00', '00:30' => '00:30', '01:00' => '01:00', '01:30' => '01:30', '02:00' => '02:00', '02:30' => '02:30',  
        '03:00' => '03:00', '03:30' => '03:30', '04:00' => '04:00', '04:30' => '04:30', '05:00' => '05:00', '05:30' => '05:30',   
        '06:00' => '06:00', '06:30' => '06:30', '07:00' => '07:00', '07:30' => '07:30', '08:00' => '08:00', '08:30' => '08:30',
        '09:00' => '09:00', '09:30' => '09:30', '10:00' => '10:00', '10:30' => '10:30', '11:00' => '11:00', '11:30' => '11:30', 
        '12:00' => '12:00', '12:30' => '12:30', '13:00' => '13:00', '13:30' => '13:30', '14:00' => '14:00', '14:30' => '14:30',
        '15:00' => '15:00', '15:30' => '15:30', '16:00' => '16:00', '16:30' => '16:30', '17:00' => '17:00', '17:30' => '17:30',
        '18:00' => '18:00', '18:30' => '18:30', '19:00' => '19:00', '19:30' => '19:30', '20:00' => '20:00', '20:30' => '20:30',
        '21:00' => '21:00', '21:30' => '21:30', '22:00' => '22:00', '22:30' => '22:30', '23:00' => '23:00', '23:30' => '23:30' 
    ))
->setRequired(TRUE)
->addValidator('NotEmpty', true, array('integer', 'zero'));
$maxSelections = array('min' => 3, 'max' => 4);
$selectValid = new Zend_Validate_Between($maxSelections);
$selectValid->setMessage("Number of selected values should be minimum of '%min%' or maximum of '%max%'");
$time->size = 12;     
$this->addElement($time);

Now i want to restrict the maximum number of selections to 4. The thing is i have to store the selected values in database. Currently if a user selects more than 4, let say 6, the database will only store the first 4 values. But i want to show that error message to the user that he selected more than 4 values. I tried Zend_Validate_Between($maxSelections) as shown above. But still i don’t get any error message.

any help?

  • 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-30T14:40:06+00:00Added an answer on May 30, 2026 at 2:40 pm

    to get the error message use :

     $result = $selectValid->isValid($currently_selected_value);
        if($result){
             $selectValid->getMessages();
        }
    

    $result will contain false if $currently_selected_value (the value select in your multiselect box) is not in the specified range , in that case to get the error message.

    .

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

Sidebar

Related Questions

I'm new to the zend framework. I created a zend project with zend tool,
I have created a new project in Zend. Now it runs on the settings
I am busy with a new project based on zend framework. I have created
I have created new PDFs many times using Zend and PHP. But Now I
me created a zend form and want to add dynamic text box in it.
I've noticed something interesting about Zend Framework's bootstrap. I created a new project and
I have created one form that extends zend form. For Adding New Record it
I am new to zend framework and having very basic doubt.I have created one
Using Zend Framework, I've created a Model to insert a record into a database.
I'm using the Zend Framework for my website, and just created a special module

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.