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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:40:16+00:00 2026-06-08T12:40:16+00:00

I am a newbie to Zend Framework and I am trying to making a

  • 0

I am a newbie to Zend Framework and I am trying to making a Form using Zend Form. In that Form I want cascading drop downs of country, state and city. I have filled country’s drop down from database but I have no idea how do I fill state’s drop down by getting the country id.

Thanks in advance.

  • 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-08T12:40:18+00:00Added an answer on June 8, 2026 at 12:40 pm

    To dynamically load countries you should use it the way you did:

    I have done this previously with standard php and jquery

    And here is nothing to do with Zend_Form. You should have a JSON service (for e.g.) that will accept CountryID and will return all states available.

    For this purpose you should connect jQuery library in your <head> section.

    $this->view->headScript()->appendFile('/js/jquery-1.7.3.js'); // In your Controller
    

    Add you jQuery script to your template which will handle all events like this:

    $_form->inlineScript()->appendScript(' // my raw JS here');
    

    or

    $_form->inlineScript()->appendFile('js/dynamicCountry.js'); // if you want to keep it in separate file
    

    And here you are, nothing to do with Zend_From except assigning correct elements ID‘s, classes or names.

    And for your service you can do smth. similar. Suppose URL http://localhost/mysite/service/states/country/AT

    /**
     * In your Service controller disable rendering for your layout and views
     */
    public function preDispatch() {
            $this->_helper->layout()->disableLayout(); // if you have `layout` enabled
            $this->_helper->viewRenderer->setNoRender(true);
        }
    

    and … welcome

    public function statesAction() {
    
        $request = $this->getRequest();
    
        /**
         * Country code transmitted through the parameter
         * @var string
         */
        $country = $request->getParam('country');
    
            // you are free to do whatever you want and return JSON (for e.g.)
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using zend Framework Form, I am newbie in zend Framework and i
I am newbie to Zend framework. I want to learn Decorators and Bootstrap .
I am a newbie in zf, recently I m making a register form using
As a newbie of Zend framework, I have a few version-dependent questions on the
I am newbie in zend framework , a simple question : in my IndexController
A total newbie question I know. I'm sing Zend framework, and sending an array
Newbie C++ programmer here. I'm trying to write a command line application that takes
I am a newbie with zend. On the web-site i am building using zend/php,
Newbie... I want to create a dynamicly growing list that will hold Point variables,
Newbie question again... I already have the following code for making links shortened using

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.