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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:48:35+00:00 2026-05-31T23:48:35+00:00

The Zend Form is proving to be a bit tricky for me, even as

  • 0

The Zend Form is proving to be a bit tricky for me, even as much as I am working with it lately…

I have this form and I am attempting to dynamically create the several checkboxes for it. It is working out alright, except I cannot seem to get the ‘value’ attribute to change.

In my Zend form class I have this snippet…

// psychotic symptoms
        $this->addElement('checkbox', 'psychoticsymptom', array(
                'label' => 'psychoticsymptom',
                'name' => 'psychoticsymptom',
        ));

In my view (phtml) I am calling it like this…

<div class="element">
    <?php // Psychotic Symptoms
    $Criteria = new Criteria();
    $Criteria->add( DictionaryPeer::CATEGORY, 'MAR: Psychotic Symptoms' );
    $Criteria->addAscendingOrderByColumn( 'Ordinal' );
    $this->PsychoticSymptomsList = DictionaryPeer::doSelect( $Criteria );

    foreach( $this->PsychoticSymptomsList as $Symptom ) {

        $form->psychoticsymptom->setValue($Symptom->getDictionaryId());
        $form->psychoticsymptom->setAttrib('name', $Symptom->getWord());

        echo $Symptom->getDictionaryId(); // prove my id is coming through... (it is)
        $form->psychoticsymptom->getDecorator('label')->setTag(null);

        echo $form->psychoticsymptom->renderViewHelper();
        $form->psychoticsymptom->setLabel($Symptom->getWord());
        echo $form->psychoticsymptom->renderLabel();
        echo '<br />';
                    }
        ?>
    </div>

Everything seems to be working fine, except the value attribute on each checkbox is rendering a value of ‘1’. I have tried moving the ‘setValue’ line to several different positions, as to set the value before the form element renders but I am having no luck getting this to work. It’s worth any effort to me because I need to do the same type of operation in many areas of my application. I would have done this a bit different too, but I am re-factoring another application and am trying to keep some things unchanged (like the database for instance).

Any help is much appriciated
Thanks

  • 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-31T23:48:35+00:00Added an answer on May 31, 2026 at 11:48 pm

    you can try to overwrite the “checkedValue” and “uncheckedValue”. check this reference

    $this->addElement('checkbox', 'psychoticsymptom', array(
                    'label' => 'psychoticsymptom',
                    'name' => 'psychoticsymptom',
                    'checkedValue' => 'checked Value',
                    'uncheckedValue' => 'unchecked Value'
            ));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Form element: $Form=new Zend_Form; $Form->setAction($this->view->url(array('controller'=>'auth','action'=>'create'),null,true)) ->setMethod('post') ->setAttrib('id','auth-form') ->removeAttrib('enctype'); As can be
Hello i have a Zend Form with 2(two) Zend_Validate_Db_RecordExists toghether like this : $ditta_esiste
I'm working with Zend Form and I need to dynamically (when filling out the
Using Zend_Form, how would I create form elements like this: <input type=text name=element[1] value=
Using Zend_Form, how would I create form elements like this <input type=text name=element[1] value=/>
I have a zend form that I'm initializing as follows: $form = new Form_XYZ();
I'm using Zend_Form from Zend Framework 1.10.6 to render a html form. In this
How can I create Zend Form Element implements A html tag not INPUT. I
I have a zend form, and I need to provide a dynamic link on
I am using zend_form (part of Zend Framwork) to create a form and found

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.