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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:50:52+00:00 2026-05-28T19:50:52+00:00

I have the following php script now i want to put his script in

  • 0

I have the following php script now i want to put his script in zend forms Here is my code so far :-

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

foreach ($parents as $parent) {
     echo '<div>';
     $parent_value = "'$parent'";
     echo '<div><input type="checkbox" name="parents[]" value="'.$parent.'" id="'.$parent.'" class="parentCheck"/>
     <label for="parents_'.$parent.'">'.$parent.'</label></div>';
     foreach ($childs[$parent] as $child) {
           $child_value = "'$child'";
               echo '<div style="margin-left:15px;"><input type="checkbox" name="childs[]" value="'.$child.'" id="childs_'.$child.'" class="child_'.$parent.'" onclick="checkParent('.$parent_value.','.$child_value.');"/>
              <label for="childs_'.$child.'">'.$child.'</label></div>';
     }
     echo '</div>';
} 

also i am using some javascript code here

<script>
jQuery(document).ready(function(){
      // add multiple select / deselect functionality
      jQuery(".parentCheck").click(function () {
           var childId = jQuery(this).attr('id');
           jQuery('.child_'+childId).attr('checked', this.checked);
      });
 });
 function checkParent(parentId,childId) {
    if(jQuery(".child_"+parentId).length == $(".child_"+parentId+":checked").length) {
           $('#'+parentId).attr("checked", "checked");
       } else {
           $('#'+parentId).removeAttr("checked");
       }
 }  

</script>

this works good for me in .phtml page but actually i want to put this code in zend form and call like this

echo $this->form ;

what i can do?

Note :- here Tagkey is :-

$tags =new Campaign_Model_DbTable_Tag();
$aResultData = $tags->getTagkey(); 
$this->view->Tagkey = $aResultData;
  • 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-28T19:50:53+00:00Added an answer on May 28, 2026 at 7:50 pm

    You can make sub form to each parent and child.

    EG :-

    !!! zend method name may be incorrect. please find the those methods. This is only way to do your work. Try with form decorators.

    code of testForm.php

    $form = Zend_Form();
    
    foreach ($parents as $parent) {
    
       $subForm = new Zend_SubForm();
       $subForm->addElement($parent);
    
       foreach ($children as $child) {
           $subForm->addElement($child);
       }
    
       $form->addSubForm($subForm);
    }
    

    Why are you use onclick method in element? Try it using Jquery click function like your another code. 🙂

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

Sidebar

Related Questions

I have the following php script now i want to put his script in
I have the following PHP-script, now I need to do the same thing in
I have the following PHP script: <?php $fortune = `fortune`; echo $fortune; ?> but
I have the following situation. I have a PHP script that imports a CSV
I have a PHP script that does the following: Uses file_get_contents() to get content
i have the following simple script <input class=input type=text name=password style=color: #797272; value= <?php
I have a directory structure like the following; script.php inc/include1.php inc/include2.php objects/object1.php objects/object2.php soap/soap.php
I have following PHP code $val=<div id=user.$row['cid']. userid=.$row['cid']. class=innertxt><img src=images/images.jpg width=50 height=50><strong>.$uname.</strong><ul> <li>Email: .$row['cemail'].</li>
I have the following php code, which has been snipped for brevity. I am
I have the following PHP code which works out the possible combinations from a

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.