【问题标题】:form input pararel in zend form以zend形式输入pararel
【发布时间】:2013-05-08 02:56:19
【问题描述】:

我想创建与 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>

我该怎么做??

请有人帮帮我。

【问题讨论】:

    标签: php html zend-framework zend-form


    【解决方案1】:
    $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'
    
        ));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-25
      • 2011-09-02
      相关资源
      最近更新 更多