2013-05-08 38 views
0

我想創建與zend格式並行的表單輸入。 我該怎麼做?以zend格式輸入pararel

我有這樣的代碼:

$this->addElement('select', 'curr', array(
'label'  => 'Price', 
'required' => true, 
'multiOptions' => array('usd' => 'USD', 'idr' => 'IDR'), 
)); 

$this->addElement('text', 'price', array(
'label'  => '', 
'required' => true, 
)); 

而且我想是這樣的:

<div class="control-group"> 
    <label class="control-label required" for="f-price">Price</label> 
    <div class="controls"> 
    <select id="f-curr" name="f[curr]> 
    <option value='usd'>USD</option> 
    <option value='idr'>IDR</option> 
    </select> 
    <input type="text" value="" id="f-price" name="f[price]"> 
    </div> 
</div> 

怎麼做呢?

有人請幫助我。

回答

0
$countryList=array('USA','IDR'); 

$country = $this->createElement('select', 'country'); 
    $country->setLabel(': country') 
      ->setAttrib('class','select') 
      ->addMultiOptions($countryList) 
      ->setRequired(false); 


    $this->addElement($country); 
$firstName = $this->addElement('text', 'fprice', array(
    'filters' => array('StringTrim', 'StringToLower'), 
     'id' => 'fprice', 

     'required' => true, 

     'label'  => ': name' 

    ));