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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:03:34+00:00 2026-05-28T20:03:34+00:00

I am using zend Framework Form, I am newbie in zend Framework and i

  • 0

I am using zend Framework Form,
I am newbie in zend Framework and i want to display my check box form like this :-

*SK336
  *CP
  *PES
  *JCP
  *BGH
*SK996
  *KO
  *RTY
  *HGR
*SK547
  *GPK
*SK478
  *JUP

Note where :- * is check-box here

what i am trying is here :-

public function init()
{

  $parents = array();
     $childs = array();
     foreach ($this->Tagkey as $aResultDataValue) {
                    $parents [$aResultDataValue['parent']] = $aResultDataValue['parent'];
                    $childs [$aResultDataValue['parent']][] = $aResultDataValue['child'];
    }


    foreach ($parents as $parent){ // print_r ($parents); die();
    $tags = new Zend_Form_SubForm();
    $tags->addElements(array(   
    new Zend_Form_Element_MultiCheckbox('parent', array(
                    'multiOptions' =>   array($parent),
                    'filters'      => array('StringTrim'),
                    'validators'   => array(
                    array('InArray',
                          false,
                          array($parent))
                          )

       )),
       ));
    foreach ($childs as $child){
    $tags->addElements(array(
    new Zend_Form_Element_MultiCheckbox('child', array(
          'multiOptions' => array($child),
          'filters'      => array('StringTrim'),
          'validators'   => array(
                    array('InArray',
                          false,
                          $child)
                          )    
        )),
        ));
    }

    $this->addSubForms(array(
    'tags'  => $tags,
        )
    );
    }

I am able to create such type of structure in any .php page but not able to do that right now in zend framework form, I am using zend sub-form here.

Also I got an error right now when i am using this query

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /var/www/dashboard_campaign/library/Zend/View/Abstract.php on line 905

More Information about my Question :-

(1) mysql qyery

select  b.tagCode parent,a.tagCode child from tag a, tag b where a.tagParentId=b.tagId

(2) output of Zend_Debug::dump($this->Tagkey);

array(9) {
  [0] => array(2) {
    ["parent"] => string(5) "SK336"
    ["child"] => string(2) "CP"
  }
  [1] => array(2) {
    ["parent"] => string(5) "SK336"
    ["child"] => string(3) "PES"
  }
  [2] => array(2) {
    ["parent"] => string(5) "SK336"
    ["child"] => string(3) "JCP"
  }
  [3] => array(2) {
    ["parent"] => string(5) "SK996"
    ["child"] => string(2) "KO"
  }
  [4] => array(2) {
    ["parent"] => string(5) "SK996"
    ["child"] => string(3) "RTY"
  }
  [5] => array(2) {
    ["parent"] => string(5) "SK996"
    ["child"] => string(3) "HGR"
  }
  [6] => array(2) {
    ["parent"] => string(5) "SK547"
    ["child"] => string(3) "GPK"
  }
  [7] => array(2) {
    ["parent"] => string(5) "SK478"
    ["child"] => string(3) "JUP"
  }
  [8] => array(2) {
    ["parent"] => string(5) "SK336"
    ["child"] => string(3) "BGH"
  }
}
  • 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-28T20:03:35+00:00Added an answer on May 28, 2026 at 8:03 pm

    Now i can understand your problem. I think it is to hard for handle that think from sub form. Try to use zend view scripts as following way.

    Your form.php

    public function init()
    {
        foreach ($parents as $parent) {
    
            $parent = new Zend_Form_Element_Hidden($parent);
            $parent->setDecorators(array(
                    array(
                          'ViewScript',
                           array(
                            'viewScript' => 'customviewscripts/parent.phtml',
                            'parent' => $parent           
                        )
                    )
                );
           $this->addElement($parent);     
        }
    
    }
    

    file at views/script/customviewscript/parent.phtml

    <?php
    
        $params = $this->element->getDecorator('ViewScript')->getOptions();
        $parent = $parems['parent'];
    
        $string = '<label>$parent['name']</label><input type="check" name="parent[]">';
        foreach ($children as $child) {
             $string .= <label>$child['name']</label>
                     . <input type="check" name=child[$parent[id]][]>' ;
    
        }
    
        print $string; 
    ?>
    

    This is not the real solution. I percent only example. I think you can customize that. Most of developer use view script to make complex forms.

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

Sidebar

Related Questions

I'm using Zend_Form from Zend Framework 1.10.6 to render a html form. In this
I'm using the Zend Framework's javascript helpers of the form: <?php $this->headScript()->captureStart(); ?> //Javascript
Hello i am using Zend Framework Form and have tried to get this example
I am using zend framework and want to create a zend form where the
I am using FirePHP with Zend Framework. When the user submits a form, I
I am building a form in Zend Framework 1.9 using subforms as well as
In Zend Framework I'm using the standard FormErrors decorator to output form errors in
I'm doing this tutorial: http://www.phpeveryday.com/articles/Zend-Framework-Database-Creating-Input-Form-P494.html We are building a simple input form using POST
I am using Zend Framework. For a particular form, there is not enough space
I am developing a website using zend framework. i have a search form with

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.