0

我想创建与 zend 表单并行的表单输入。我该怎么做 ??

我有这个代码:

$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>

我该怎么做 ??

有人请帮助我。

4

1 回答 1

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'

    ));
于 2013-05-08T10:56:55.957 回答