2012-12-03 2 views
0

J'ai une forme en php en utilisant xend framework. Je ne parviens pas à obtenir la valeur d'un bouton radiozend forme post comment obtenir variable

ce que j'ai dans le contrôleur

if ($this->getRequest()->isXmlHttpRequest()) { 
      if ($this->getRequest()->isPost()) { 
       // check session for line and dataset function 
       // update queue 
       $data = $this->_request->getParams(); 
     print_r($_POST['locations']); 
     exit(); 
       $this->submitAction(); 
      } 
     } 

forme

class Application_Form_LineData extends Zend_Form 
{ 
    private $lineId; 
    private $dataId; 
    private $name; 

    public function init() 
    { 
     /* Form Elements & Other Definitions Here ... */ 
    } 

    public $elementDecoration = array(
      'ViewHelper', 
      //'Description', 
      //'Errors', 
      array(array('data'=>'HtmlTag'), array('tag' => 'td')), 
      //array('Label', array('tag' => 'td')), 
      //array('Errors'), 
      //array(array('row'=>'HtmlTag'),array('tag'=>'tr')) 
    ); 

    public $elementRowDecoration = array(
      'ViewHelper', 
      array(array('row' => 'HtmlTag'), array('tag' => 'tr')) 
    ); 

    public $elementTableDecoration = array(
      'ViewHelper', 
      array(array('data' => 'HtmlTag'), array('tag' => 'td')), 
      array(array('row' => 'HtmlTag'), array('tag' => 'tr')) 
    ); 

    public $formDecoration = array(
      'FormElements', 
      array(array('data'=>'HtmlTag'), array('tag'=>'table', 'class'=>'forms')), 
      'Form' 
    ); 


    public function setLineId($lineId) 
    { 
     $this->lineId = $lineId; 
    } 

    public function setName($name) 
    { 
     $this->name = $name; 
    } 

    public function setDataId($dataId) 
    { 
     $this->dataId = $dataId; 
    } 

    public function startform($entries) 
    { 
     $this->setMethod('post') ->setAttrib('enctype', 'multipart/form-data'); 

     $count = count($entries); 
     for($i=0;$i<$count;$i++){ 

      $this->addElement('checkbox', 'l_'.$entries[$i]['PGA_Id'], array(
        'decorators' => $this->elementDecoration, 
        'onclick' => 'updateQueue('.$entries[$i]['PGA_Id'].',false)', 

      )); 



      // Data sets for each line 

      $countData = count($entries[$i]['Data_Set']); 
      for($x=0;$x<$countData;$x++){ 

       $this->addElement('checkbox', 'ds_'.$entries[$i]['Data_Set'][$x]['PGA_Id'], array(
         'id' => 'ds_'.$entries[$i]['Data_Set'][$x]['PGA_Id'], 
         'decorators' => $this->elementDecoration, 
         'class' => 'line_'.$entries[$i]['PGA_Id'], 
         'onclick' => 'updateQueue('.$entries[$i]['PGA_Id'].','.$entries[$i]['Data_Set'][$x]['PGA_Id'].')', 
         'name' => 'line_'.$entries[$i]['PGA_Id'], 

       )); 
      } 


     } 

     $this->addElement('radio', 'locations', array(
       //'label' => 'Download to: ', 
       'multiOptions' => array(
         'woking' => 'Woking', 
         'cairo' => 'Cairo' 
       ), 
       'decorators' => $this->elementDecoration 
     )); 

     $this->addElement('submit', 'submit', array(
       'ignore' => true, 
       'label' => 'Add to queue', 
       'decorators' => $this->elementDecoration 
     )); 

     return $this; 
    } 
} 

Je veux obtenir la valeur des lieux du boîte radio.

mon avis

<script type="text/javascript"> 
<!-- 
$(function() { 
    showhide("dataqueue"); 
}); 
//--> 
</script> 

    <!-- display queue for project --> 
    <div id="dataqueue"> 
     <?php echo $this->dataQueueTable($this->queue,$this->qstatus); ?> 
    </div> 

    <div id="datalist"> 
    <form method="post"> 
    <table class=table> 
     <tr> 
      <!-- <th class="tdid">ID</th> --> 
      <th class="tdname">Name</th> 
      <!-- <th>Path</th> --> 
      <th>Add to Queue</th> 
     </tr> 
     <?php 

     foreach ($this->entries as $entry){ ?> 
     <tr class=parent id=<?=$entry['PGA_Id'] ?>> 
      <!-- <td><?php echo $entry['PGA_Id'] ?></td> --> 
      <td><?php echo $entry['PGA_Name'] ?> </td> 

      <?php //echo $this->form->getElement('l_'.$entry['PGA_Id']) ?> 

      <?php 
      foreach($entry['Data_Set'] as $data){ 
      ?> 
      <tr class=child-<?=$entry['PGA_Id'] ?>> 
      <td colspan="3"> 
      <table class="tdatasets"> 
       <tr> 
        <!-- <td class="tdid"><?php echo $data['PGA_Id'] ;?></td> --> 
        <td class="subtdname"><?php echo $data['PGA_Name'] ; ?></td> 
        <!-- <td><?php echo $data['PGA_Path'] ; ?></td> --> 
        <?php echo $this->form->getElement('ds_'.$data['PGA_Id']) ?> 
        <td><?php echo $data['size']; ?></td> 
       </tr> 
      </table> 
      </td> 
      </tr> 
      <?php } ?> 

     </tr> 
     <?php } ?> 
     <tr> 
      <td style="">Download to:</td> 
      <?php echo $this->form->getElement('locations') ?> 
      <?php echo $this->form->getElement('submit') ?> 
     </tr> 
    </table> 
    </form> 
    </div> 


    <div id="notification"> 
     <?php echo $this->notificationTable($this->notification,$this->notificationform); ?> 
    </div> 
+0

pouvez-vous commenter pour le downvote? – shorif2000

+1

Je pense que c'est parce que beaucoup de code et une question très simple :) Upvoted))) –

Répondre

1
$this->getRequest()->getParams(); 
0

j'utilisais ajax pour passer la forme, a passé une journée entière à essayer de penser pourquoi il ne fonctionne pas. mon erreur